diff options
Diffstat (limited to 'src/bun.js/builtins/cpp')
48 files changed, 0 insertions, 17400 deletions
diff --git a/src/bun.js/builtins/cpp/BundlerPluginBuiltins.cpp b/src/bun.js/builtins/cpp/BundlerPluginBuiltins.cpp deleted file mode 100644 index ec6ce4070..000000000 --- a/src/bun.js/builtins/cpp/BundlerPluginBuiltins.cpp +++ /dev/null @@ -1,515 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "BundlerPluginBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_bundlerPluginRunOnResolvePluginsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_bundlerPluginRunOnResolvePluginsCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_bundlerPluginRunOnResolvePluginsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_bundlerPluginRunOnResolvePluginsCodeLength = 3619; -static const JSC::Intrinsic s_bundlerPluginRunOnResolvePluginsCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_bundlerPluginRunOnResolvePluginsCode = - "(function (\n" \ - " specifier,\n" \ - " inputNamespace,\n" \ - " importer,\n" \ - " internalID,\n" \ - " kindId\n" \ - ") {\n" \ - " \"use strict\";\n" \ - "\n" \ - " //\n" \ - " const kind = [\n" \ - " \"entry-point\",\n" \ - " \"import-statement\",\n" \ - " \"require-call\",\n" \ - " \"dynamic-import\",\n" \ - " \"require-resolve\",\n" \ - " \"import-rule\",\n" \ - " \"url-token\",\n" \ - " \"internal\",\n" \ - " ][kindId];\n" \ - "\n" \ - " var promiseResult = (async (inputPath, inputNamespace, importer, kind) => {\n" \ - " var {onResolve, onLoad} = this;\n" \ - " var results = onResolve.@get(inputNamespace);\n" \ - " if (!results) {\n" \ - " this.onResolveAsync(internalID, null, null, null);\n" \ - " return null;\n" \ - " }\n" \ - "\n" \ - " for (let [filter, callback] of results) {\n" \ - " if (filter.test(inputPath)) {\n" \ - " var result = callback({\n" \ - " path: inputPath,\n" \ - " importer,\n" \ - " namespace: inputNamespace,\n" \ - " //\n" \ - " kind,\n" \ - " //\n" \ - " });\n" \ - "\n" \ - " while (\n" \ - " result &&\n" \ - " @isPromise(result) &&\n" \ - " (@getPromiseInternalField(result, @promiseFieldFlags) &\n" \ - " @promiseStateMask) ===\n" \ - " @promiseStateFulfilled\n" \ - " ) {\n" \ - " result = @getPromiseInternalField(\n" \ - " result,\n" \ - " @promiseFieldReactionsOrResult\n" \ - " );\n" \ - " }\n" \ - "\n" \ - " if (result && @isPromise(result)) {\n" \ - " result = await result;\n" \ - " }\n" \ - "\n" \ - " if (!result || !@isObject(result)) {\n" \ - " continue;\n" \ - " }\n" \ - "\n" \ - "\n" \ - " var {\n" \ - " path,\n" \ - " namespace: userNamespace = inputNamespace,\n" \ - " external,\n" \ - " } = result;\n" \ - " if (\n" \ - " !(typeof path === \"string\") ||\n" \ - " !(typeof userNamespace === \"string\")\n" \ - " ) {\n" \ - " @throwTypeError(\n" \ - " \"onResolve plugins must return an object with a string 'path' and string 'loader' field\"\n" \ - " );\n" \ - " }\n" \ - "\n" \ - " if (!path) {\n" \ - " continue;\n" \ - " }\n" \ - "\n" \ - " if (!userNamespace) {\n" \ - " userNamespace = inputNamespace;\n" \ - " }\n" \ - " if (typeof external !== \"boolean\" && !@isUndefinedOrNull(external)) {\n" \ - " @throwTypeError(\n" \ - " 'onResolve plugins \"external\" field must be boolean or unspecified'\n" \ - " );\n" \ - " }\n" \ - "\n" \ - "\n" \ - " if (!external) {\n" \ - " if (userNamespace === \"file\") {\n" \ - " //\n" \ - " \n" \ - " if (path[0] !== \"/\" || path.includes(\"..\")) {\n" \ - " @throwTypeError(\n" \ - " 'onResolve plugin \"path\" must be absolute when the namespace is \"file\"'\n" \ - " );\n" \ - " }\n" \ - " }\n" \ - " if (userNamespace === \"dataurl\") {\n" \ - " if (!path.startsWith(\"data:\")) {\n" \ - " @throwTypeError(\n" \ - " 'onResolve plugin \"path\" must start with \"data:\" when the namespace is \"dataurl\"'\n" \ - " );\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " if (userNamespace && userNamespace !== \"file\" && (!onLoad || !onLoad.@has(userNamespace))) {\n" \ - " @throwTypeError(\n" \ - " `Expected onLoad plugin for namespace ${@jsonStringify(userNamespace, \" \")} to exist`\n" \ - " );\n" \ - " }\n" \ - "\n" \ - " }\n" \ - " this.onResolveAsync(internalID, path, userNamespace, external);\n" \ - " return null;\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " this.onResolveAsync(internalID, null, null, null);\n" \ - " return null;\n" \ - " })(specifier, inputNamespace, importer, kind);\n" \ - "\n" \ - " while (\n" \ - " promiseResult &&\n" \ - " @isPromise(promiseResult) &&\n" \ - " (@getPromiseInternalField(promiseResult, @promiseFieldFlags) &\n" \ - " @promiseStateMask) ===\n" \ - " @promiseStateFulfilled\n" \ - " ) {\n" \ - " promiseResult = @getPromiseInternalField(\n" \ - " promiseResult,\n" \ - " @promiseFieldReactionsOrResult\n" \ - " );\n" \ - " }\n" \ - "\n" \ - " if (promiseResult && @isPromise(promiseResult)) {\n" \ - " promiseResult.then(\n" \ - " () => {},\n" \ - " (e) => {\n" \ - " this.addError(internalID, e, 0);\n" \ - " }\n" \ - " );\n" \ - " }\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_bundlerPluginRunSetupFunctionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_bundlerPluginRunSetupFunctionCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_bundlerPluginRunSetupFunctionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_bundlerPluginRunSetupFunctionCodeLength = 4549; -static const JSC::Intrinsic s_bundlerPluginRunSetupFunctionCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_bundlerPluginRunSetupFunctionCode = - "(function (setup, config) {\n" \ - " \"use strict\";\n" \ - " var onLoadPlugins = new Map(),\n" \ - " onResolvePlugins = new Map();\n" \ - "\n" \ - " function validate(filterObject, callback, map) {\n" \ - " if (!filterObject || !@isObject(filterObject)) {\n" \ - " @throwTypeError('Expected an object with \"filter\" RegExp');\n" \ - " }\n" \ - "\n" \ - " if (!callback || !@isCallable(callback)) {\n" \ - " @throwTypeError(\"callback must be a function\");\n" \ - " }\n" \ - "\n" \ - " var { filter, namespace = \"file\" } = filterObject;\n" \ - "\n" \ - " if (!filter) {\n" \ - " @throwTypeError('Expected an object with \"filter\" RegExp');\n" \ - " }\n" \ - "\n" \ - " if (!@isRegExpObject(filter)) {\n" \ - " @throwTypeError(\"filter must be a RegExp\");\n" \ - " }\n" \ - "\n" \ - " if (namespace && !(typeof namespace === \"string\")) {\n" \ - " @throwTypeError(\"namespace must be a string\");\n" \ - " }\n" \ - "\n" \ - " if ((namespace?.length ?? 0) === 0) {\n" \ - " namespace = \"file\";\n" \ - " }\n" \ - "\n" \ - " if (!/^([/@a-zA-Z0-9_\\\\-]+)$/.test(namespace)) {\n" \ - " @throwTypeError(\"namespace can only contain @a-zA-Z0-9_\\\\-\");\n" \ - " }\n" \ - "\n" \ - " var callbacks = map.@get(namespace);\n" \ - "\n" \ - " if (!callbacks) {\n" \ - " map.@set(namespace, [[filter, callback]]);\n" \ - " } else {\n" \ - " @arrayPush(callbacks, [filter, callback]);\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " function onLoad(filterObject, callback) {\n" \ - " validate(filterObject, callback, onLoadPlugins);\n" \ - " }\n" \ - "\n" \ - " function onResolve(filterObject, callback) {\n" \ - " validate(filterObject, callback, onResolvePlugins);\n" \ - " }\n" \ - "\n" \ - " function onStart(callback) {\n" \ - " //\n" \ - " @throwTypeError(\"On-start callbacks are not implemented yet. See https:/\\/github.com/oven-sh/bun/issues/2771\");\n" \ - " }\n" \ - "\n" \ - " function onEnd(callback) {\n" \ - " @throwTypeError(\"On-end callbacks are not implemented yet. See https:/\\/github.com/oven-sh/bun/issues/2771\");\n" \ - " }\n" \ - "\n" \ - " function onDispose(callback) {\n" \ - " @throwTypeError(\"On-dispose callbacks are not implemented yet. See https:/\\/github.com/oven-sh/bun/issues/2771\");\n" \ - " }\n" \ - "\n" \ - " function resolve(callback) {\n" \ - " @throwTypeError(\"build.resolve() is not implemented yet. See https:/\\/github.com/oven-sh/bun/issues/2771\");\n" \ - " }\n" \ - "\n" \ - " const processSetupResult = () => {\n" \ - " var anyOnLoad = false,\n" \ - " anyOnResolve = false;\n" \ - "\n" \ - " for (var [namespace, callbacks] of onLoadPlugins.entries()) {\n" \ - " for (var [filter] of callbacks) {\n" \ - " this.addFilter(filter, namespace, 1);\n" \ - " anyOnLoad = true;\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " for (var [namespace, callbacks] of onResolvePlugins.entries()) {\n" \ - " for (var [filter] of callbacks) {\n" \ - " this.addFilter(filter, namespace, 0);\n" \ - " anyOnResolve = true;\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " if (anyOnResolve) {\n" \ - " var onResolveObject = this.onResolve;\n" \ - " if (!onResolveObject) {\n" \ - " this.onResolve = onResolvePlugins;\n" \ - " } else {\n" \ - " for (var [namespace, callbacks] of onResolvePlugins.entries()) {\n" \ - " var existing = onResolveObject.@get(namespace);\n" \ - "\n" \ - " if (!existing) {\n" \ - " onResolveObject.@set(namespace, callbacks);\n" \ - " } else {\n" \ - " onResolveObject.@set(namespace, existing.concat(callbacks));\n" \ - " }\n" \ - " }\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " if (anyOnLoad) {\n" \ - " var onLoadObject = this.onLoad;\n" \ - " if (!onLoadObject) {\n" \ - " this.onLoad = onLoadPlugins;\n" \ - " } else {\n" \ - " for (var [namespace, callbacks] of onLoadPlugins.entries()) {\n" \ - " var existing = onLoadObject.@get(namespace);\n" \ - "\n" \ - " if (!existing) {\n" \ - " onLoadObject.@set(namespace, callbacks);\n" \ - " } else {\n" \ - " onLoadObject.@set(namespace, existing.concat(callbacks));\n" \ - " }\n" \ - " }\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " return anyOnLoad || anyOnResolve;\n" \ - " };\n" \ - "\n" \ - " var setupResult = setup({\n" \ - " config,\n" \ - " onDispose,\n" \ - " onEnd,\n" \ - " onLoad,\n" \ - " onResolve,\n" \ - " onStart,\n" \ - " resolve,\n" \ - " //\n" \ - " initialOptions: {\n" \ - " ...config,\n" \ - " bundle: true,\n" \ - " entryPoints: config.entrypoints ?? config.entryPoints ?? [],\n" \ - " minify: typeof config.minify === 'boolean' ? config.minify : false,\n" \ - " minifyIdentifiers: config.minify === true || config.minify?.identifiers,\n" \ - " minifyWhitespace: config.minify === true || config.minify?.whitespace,\n" \ - " minifySyntax: config.minify === true || config.minify?.syntax,\n" \ - " outbase: config.root,\n" \ - " platform: config.target === 'bun' ? 'node' : config.target,\n" \ - " root: undefined,\n" \ - " },\n" \ - " esbuild: {},\n" \ - " });\n" \ - "\n" \ - " if (setupResult && @isPromise(setupResult)) {\n" \ - " if (\n" \ - " @getPromiseInternalField(setupResult, @promiseFieldFlags) &\n" \ - " @promiseStateFulfilled\n" \ - " ) {\n" \ - " setupResult = @getPromiseInternalField(\n" \ - " setupResult,\n" \ - " @promiseFieldReactionsOrResult\n" \ - " );\n" \ - " } else {\n" \ - " return setupResult.@then(processSetupResult);\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " return processSetupResult();\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_bundlerPluginRunOnLoadPluginsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_bundlerPluginRunOnLoadPluginsCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_bundlerPluginRunOnLoadPluginsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_bundlerPluginRunOnLoadPluginsCodeLength = 2766; -static const JSC::Intrinsic s_bundlerPluginRunOnLoadPluginsCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_bundlerPluginRunOnLoadPluginsCode = - "(function (internalID, path, namespace, defaultLoaderId) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " const LOADERS_MAP = {\n" \ - " jsx: 0,\n" \ - " js: 1,\n" \ - " ts: 2,\n" \ - " tsx: 3,\n" \ - " css: 4,\n" \ - " file: 5,\n" \ - " json: 6,\n" \ - " toml: 7,\n" \ - " wasm: 8,\n" \ - " napi: 9,\n" \ - " base64: 10,\n" \ - " dataurl: 11,\n" \ - " text: 12,\n" \ - " };\n" \ - " const loaderName = [\n" \ - " \"jsx\",\n" \ - " \"js\",\n" \ - " \"ts\",\n" \ - " \"tsx\",\n" \ - " \"css\",\n" \ - " \"file\",\n" \ - " \"json\",\n" \ - " \"toml\",\n" \ - " \"wasm\",\n" \ - " \"napi\",\n" \ - " \"base64\",\n" \ - " \"dataurl\",\n" \ - " \"text\",\n" \ - " ][defaultLoaderId];\n" \ - "\n" \ - " var promiseResult = (async (internalID, path, namespace, defaultLoader) => {\n" \ - " var results = this.onLoad.@get(namespace);\n" \ - " if (!results) {\n" \ - " this.onLoadAsync(internalID, null, null, null);\n" \ - " return null;\n" \ - " }\n" \ - "\n" \ - " for (let [filter, callback] of results) {\n" \ - " if (filter.test(path)) {\n" \ - " var result = callback({\n" \ - " path,\n" \ - " namespace,\n" \ - " //\n" \ - " //\n" \ - " loader: defaultLoader,\n" \ - " });\n" \ - "\n" \ - " while (\n" \ - " result &&\n" \ - " @isPromise(result) &&\n" \ - " (@getPromiseInternalField(result, @promiseFieldFlags) &\n" \ - " @promiseStateMask) ===\n" \ - " @promiseStateFulfilled\n" \ - " ) {\n" \ - " result = @getPromiseInternalField(\n" \ - " result,\n" \ - " @promiseFieldReactionsOrResult\n" \ - " );\n" \ - " }\n" \ - "\n" \ - " if (result && @isPromise(result)) {\n" \ - " result = await result;\n" \ - " }\n" \ - "\n" \ - " if (!result || !@isObject(result)) {\n" \ - " continue;\n" \ - " }\n" \ - "\n" \ - " var { contents, loader = defaultLoader } = result;\n" \ - " if (!(typeof contents === \"string\") && !@isTypedArrayView(contents)) {\n" \ - " @throwTypeError(\n" \ - " 'onLoad plugins must return an object with \"contents\" as a string or Uint8Array'\n" \ - " );\n" \ - " }\n" \ - "\n" \ - " if (!(typeof loader === \"string\")) {\n" \ - " @throwTypeError(\n" \ - " 'onLoad plugins must return an object with \"loader\" as a string'\n" \ - " );\n" \ - " }\n" \ - "\n" \ - " const chosenLoader = LOADERS_MAP[loader];\n" \ - " if (chosenLoader === @undefined) {\n" \ - " @throwTypeError(`Loader ${@jsonStringify(loader, \" \")} is not supported.`);\n" \ - " }\n" \ - "\n" \ - " this.onLoadAsync(internalID, contents, chosenLoader);\n" \ - " return null;\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " this.onLoadAsync(internalID, null, null);\n" \ - " return null;\n" \ - " })(internalID, path, namespace, loaderName);\n" \ - "\n" \ - " while (\n" \ - " promiseResult &&\n" \ - " @isPromise(promiseResult) &&\n" \ - " (@getPromiseInternalField(promiseResult, @promiseFieldFlags) &\n" \ - " @promiseStateMask) ===\n" \ - " @promiseStateFulfilled\n" \ - " ) {\n" \ - " promiseResult = @getPromiseInternalField(\n" \ - " promiseResult,\n" \ - " @promiseFieldReactionsOrResult\n" \ - " );\n" \ - " }\n" \ - "\n" \ - " if (promiseResult && @isPromise(promiseResult)) {\n" \ - " promiseResult.then(\n" \ - " () => {},\n" \ - " (e) => {\n" \ - " this.addError(internalID, e, 1);\n" \ - " }\n" \ - " );\n" \ - " }\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().bundlerPluginBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().bundlerPluginBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/BundlerPluginBuiltins.h b/src/bun.js/builtins/cpp/BundlerPluginBuiltins.h deleted file mode 100644 index d1fdaf4ec..000000000 --- a/src/bun.js/builtins/cpp/BundlerPluginBuiltins.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* BundlerPlugin */ -extern const char* const s_bundlerPluginRunOnResolvePluginsCode; -extern const int s_bundlerPluginRunOnResolvePluginsCodeLength; -extern const JSC::ConstructAbility s_bundlerPluginRunOnResolvePluginsCodeConstructAbility; -extern const JSC::ConstructorKind s_bundlerPluginRunOnResolvePluginsCodeConstructorKind; -extern const JSC::ImplementationVisibility s_bundlerPluginRunOnResolvePluginsCodeImplementationVisibility; -extern const char* const s_bundlerPluginRunSetupFunctionCode; -extern const int s_bundlerPluginRunSetupFunctionCodeLength; -extern const JSC::ConstructAbility s_bundlerPluginRunSetupFunctionCodeConstructAbility; -extern const JSC::ConstructorKind s_bundlerPluginRunSetupFunctionCodeConstructorKind; -extern const JSC::ImplementationVisibility s_bundlerPluginRunSetupFunctionCodeImplementationVisibility; -extern const char* const s_bundlerPluginRunOnLoadPluginsCode; -extern const int s_bundlerPluginRunOnLoadPluginsCodeLength; -extern const JSC::ConstructAbility s_bundlerPluginRunOnLoadPluginsCodeConstructAbility; -extern const JSC::ConstructorKind s_bundlerPluginRunOnLoadPluginsCodeConstructorKind; -extern const JSC::ImplementationVisibility s_bundlerPluginRunOnLoadPluginsCodeImplementationVisibility; - -#define WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_DATA(macro) \ - macro(runOnResolvePlugins, bundlerPluginRunOnResolvePlugins, 5) \ - macro(runSetupFunction, bundlerPluginRunSetupFunction, 2) \ - macro(runOnLoadPlugins, bundlerPluginRunOnLoadPlugins, 4) \ - -#define WEBCORE_BUILTIN_BUNDLERPLUGIN_RUNONRESOLVEPLUGINS 1 -#define WEBCORE_BUILTIN_BUNDLERPLUGIN_RUNSETUPFUNCTION 1 -#define WEBCORE_BUILTIN_BUNDLERPLUGIN_RUNONLOADPLUGINS 1 - -#define WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(macro) \ - macro(bundlerPluginRunOnResolvePluginsCode, runOnResolvePlugins, ASCIILiteral(), s_bundlerPluginRunOnResolvePluginsCodeLength) \ - macro(bundlerPluginRunSetupFunctionCode, runSetupFunction, ASCIILiteral(), s_bundlerPluginRunSetupFunctionCodeLength) \ - macro(bundlerPluginRunOnLoadPluginsCode, runOnLoadPlugins, ASCIILiteral(), s_bundlerPluginRunOnLoadPluginsCodeLength) \ - -#define WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_FUNCTION_NAME(macro) \ - macro(runOnLoadPlugins) \ - macro(runOnResolvePlugins) \ - macro(runSetupFunction) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class BundlerPluginBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit BundlerPluginBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* BundlerPluginBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void BundlerPluginBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_BUNDLERPLUGIN_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ByteLengthQueuingStrategyBuiltins.cpp b/src/bun.js/builtins/cpp/ByteLengthQueuingStrategyBuiltins.cpp deleted file mode 100644 index 3f5c2e8d7..000000000 --- a/src/bun.js/builtins/cpp/ByteLengthQueuingStrategyBuiltins.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "ByteLengthQueuingStrategyBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_byteLengthQueuingStrategyHighWaterMarkCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_byteLengthQueuingStrategyHighWaterMarkCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_byteLengthQueuingStrategyHighWaterMarkCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_byteLengthQueuingStrategyHighWaterMarkCodeLength = 286; -static const JSC::Intrinsic s_byteLengthQueuingStrategyHighWaterMarkCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_byteLengthQueuingStrategyHighWaterMarkCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const highWaterMark = @getByIdDirectPrivate(this, \"highWaterMark\");\n" \ - " if (highWaterMark === @undefined)\n" \ - " @throwTypeError(\"ByteLengthQueuingStrategy.highWaterMark getter called on incompatible |this| value.\");\n" \ - "\n" \ - " return highWaterMark;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_byteLengthQueuingStrategySizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_byteLengthQueuingStrategySizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_byteLengthQueuingStrategySizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_byteLengthQueuingStrategySizeCodeLength = 71; -static const JSC::Intrinsic s_byteLengthQueuingStrategySizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_byteLengthQueuingStrategySizeCode = - "(function (chunk)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " return chunk.byteLength;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeLength = 155; -static const JSC::Intrinsic s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCode = - "(function (parameters)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @putByIdDirectPrivate(this, \"highWaterMark\", @extractHighWaterMarkFromQueuingStrategyInit(parameters));\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().byteLengthQueuingStrategyBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().byteLengthQueuingStrategyBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ByteLengthQueuingStrategyBuiltins.h b/src/bun.js/builtins/cpp/ByteLengthQueuingStrategyBuiltins.h deleted file mode 100644 index 29c6f2830..000000000 --- a/src/bun.js/builtins/cpp/ByteLengthQueuingStrategyBuiltins.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* ByteLengthQueuingStrategy */ -extern const char* const s_byteLengthQueuingStrategyHighWaterMarkCode; -extern const int s_byteLengthQueuingStrategyHighWaterMarkCodeLength; -extern const JSC::ConstructAbility s_byteLengthQueuingStrategyHighWaterMarkCodeConstructAbility; -extern const JSC::ConstructorKind s_byteLengthQueuingStrategyHighWaterMarkCodeConstructorKind; -extern const JSC::ImplementationVisibility s_byteLengthQueuingStrategyHighWaterMarkCodeImplementationVisibility; -extern const char* const s_byteLengthQueuingStrategySizeCode; -extern const int s_byteLengthQueuingStrategySizeCodeLength; -extern const JSC::ConstructAbility s_byteLengthQueuingStrategySizeCodeConstructAbility; -extern const JSC::ConstructorKind s_byteLengthQueuingStrategySizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_byteLengthQueuingStrategySizeCodeImplementationVisibility; -extern const char* const s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCode; -extern const int s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeLength; -extern const JSC::ConstructAbility s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeConstructAbility; -extern const JSC::ConstructorKind s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeConstructorKind; -extern const JSC::ImplementationVisibility s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeImplementationVisibility; - -#define WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_DATA(macro) \ - macro(highWaterMark, byteLengthQueuingStrategyHighWaterMark, 0) \ - macro(size, byteLengthQueuingStrategySize, 1) \ - macro(initializeByteLengthQueuingStrategy, byteLengthQueuingStrategyInitializeByteLengthQueuingStrategy, 1) \ - -#define WEBCORE_BUILTIN_BYTELENGTHQUEUINGSTRATEGY_HIGHWATERMARK 1 -#define WEBCORE_BUILTIN_BYTELENGTHQUEUINGSTRATEGY_SIZE 1 -#define WEBCORE_BUILTIN_BYTELENGTHQUEUINGSTRATEGY_INITIALIZEBYTELENGTHQUEUINGSTRATEGY 1 - -#define WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(macro) \ - macro(byteLengthQueuingStrategyHighWaterMarkCode, highWaterMark, "get highWaterMark"_s, s_byteLengthQueuingStrategyHighWaterMarkCodeLength) \ - macro(byteLengthQueuingStrategySizeCode, size, ASCIILiteral(), s_byteLengthQueuingStrategySizeCodeLength) \ - macro(byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCode, initializeByteLengthQueuingStrategy, ASCIILiteral(), s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeLength) \ - -#define WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(macro) \ - macro(highWaterMark) \ - macro(initializeByteLengthQueuingStrategy) \ - macro(size) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ByteLengthQueuingStrategyBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ByteLengthQueuingStrategyBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ByteLengthQueuingStrategyBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ByteLengthQueuingStrategyBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ConsoleObjectBuiltins.cpp b/src/bun.js/builtins/cpp/ConsoleObjectBuiltins.cpp deleted file mode 100644 index 438c84b67..000000000 --- a/src/bun.js/builtins/cpp/ConsoleObjectBuiltins.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "ConsoleObjectBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_consoleObjectAsyncIteratorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_consoleObjectAsyncIteratorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_consoleObjectAsyncIteratorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_consoleObjectAsyncIteratorCodeLength = 2004; -static const JSC::Intrinsic s_consoleObjectAsyncIteratorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_consoleObjectAsyncIteratorCode = - "(function () {\n" \ - " \"use strict\";\n" \ - "\n" \ - " const Iterator = async function* ConsoleAsyncIterator() {\n" \ - " \"use strict\";\n" \ - "\n" \ - " const stream = @Bun.stdin.stream();\n" \ - " var reader = stream.getReader();\n" \ - "\n" \ - " //\n" \ - " var decoder = new globalThis.TextDecoder(\"utf-8\", { fatal: false });\n" \ - " var deferredError;\n" \ - " var indexOf = @Bun.indexOfLine;\n" \ - "\n" \ - " try {\n" \ - " while (true) {\n" \ - " var done, value;\n" \ - " var pendingChunk;\n" \ - " const firstResult = reader.readMany();\n" \ - " if (@isPromise(firstResult)) {\n" \ - " ({done, value} = await firstResult);\n" \ - " } else {\n" \ - " ({done, value} = firstResult);\n" \ - " }\n" \ - "\n" \ - " if (done) {\n" \ - " if (pendingChunk) {\n" \ - " yield decoder.decode(pendingChunk);\n" \ - " }\n" \ - " return;\n" \ - " }\n" \ - " \n" \ - " var actualChunk;\n" \ - " //\n" \ - " for (const chunk of value) {\n" \ - " actualChunk = chunk;\n" \ - " if (pendingChunk) {\n" \ - " actualChunk = Buffer.concat([pendingChunk, chunk]);\n" \ - " pendingChunk = null;\n" \ - " }\n" \ - "\n" \ - " var last = 0;\n" \ - " //\n" \ - " var i = indexOf(actualChunk, last);\n" \ - " while (i !== -1) {\n" \ - " yield decoder.decode(actualChunk.subarray(last, i));\n" \ - " last = i + 1;\n" \ - " i = indexOf(actualChunk, last);\n" \ - " }\n" \ - "\n" \ - " pendingChunk = actualChunk.subarray(last);\n" \ - " }\n" \ - " }\n" \ - " } catch(e) {\n" \ - " deferredError = e;\n" \ - " } finally {\n" \ - " reader.releaseLock();\n" \ - "\n" \ - " if (deferredError) {\n" \ - " throw deferredError;\n" \ - " }\n" \ - " }\n" \ - " };\n" \ - "\n" \ - " const symbol = globalThis.Symbol.asyncIterator;\n" \ - " this[symbol] = Iterator;\n" \ - " return Iterator();\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_consoleObjectWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_consoleObjectWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_consoleObjectWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_consoleObjectWriteCodeLength = 524; -static const JSC::Intrinsic s_consoleObjectWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_consoleObjectWriteCode = - "(function (input) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " var writer = @getByIdDirectPrivate(this, \"writer\");\n" \ - " if (!writer) {\n" \ - " var length = @toLength(input?.length ?? 0);\n" \ - " writer = @Bun.stdout.writer({highWaterMark: length > 65536 ? length : 65536});\n" \ - " @putByIdDirectPrivate(this, \"writer\", writer);\n" \ - " }\n" \ - "\n" \ - " var wrote = writer.write(input);\n" \ - "\n" \ - " const count = @argumentCount();\n" \ - " for (var i = 1; i < count; i++) {\n" \ - " wrote += writer.write(@argument(i));\n" \ - " }\n" \ - "\n" \ - " writer.flush(true);\n" \ - " return wrote;\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().consoleObjectBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().consoleObjectBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ConsoleObjectBuiltins.h b/src/bun.js/builtins/cpp/ConsoleObjectBuiltins.h deleted file mode 100644 index 128468602..000000000 --- a/src/bun.js/builtins/cpp/ConsoleObjectBuiltins.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* ConsoleObject */ -extern const char* const s_consoleObjectAsyncIteratorCode; -extern const int s_consoleObjectAsyncIteratorCodeLength; -extern const JSC::ConstructAbility s_consoleObjectAsyncIteratorCodeConstructAbility; -extern const JSC::ConstructorKind s_consoleObjectAsyncIteratorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_consoleObjectAsyncIteratorCodeImplementationVisibility; -extern const char* const s_consoleObjectWriteCode; -extern const int s_consoleObjectWriteCodeLength; -extern const JSC::ConstructAbility s_consoleObjectWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_consoleObjectWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_consoleObjectWriteCodeImplementationVisibility; - -#define WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_DATA(macro) \ - macro(asyncIterator, consoleObjectAsyncIterator, 0) \ - macro(write, consoleObjectWrite, 1) \ - -#define WEBCORE_BUILTIN_CONSOLEOBJECT_ASYNCITERATOR 1 -#define WEBCORE_BUILTIN_CONSOLEOBJECT_WRITE 1 - -#define WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_CODE(macro) \ - macro(consoleObjectAsyncIteratorCode, asyncIterator, "[Symbol.asyncIterator]"_s, s_consoleObjectAsyncIteratorCodeLength) \ - macro(consoleObjectWriteCode, write, ASCIILiteral(), s_consoleObjectWriteCodeLength) \ - -#define WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_FUNCTION_NAME(macro) \ - macro(asyncIterator) \ - macro(write) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ConsoleObjectBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ConsoleObjectBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ConsoleObjectBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ConsoleObjectBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_CONSOLEOBJECT_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/CountQueuingStrategyBuiltins.cpp b/src/bun.js/builtins/cpp/CountQueuingStrategyBuiltins.cpp deleted file mode 100644 index 7690a83de..000000000 --- a/src/bun.js/builtins/cpp/CountQueuingStrategyBuiltins.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "CountQueuingStrategyBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_countQueuingStrategyHighWaterMarkCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_countQueuingStrategyHighWaterMarkCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_countQueuingStrategyHighWaterMarkCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_countQueuingStrategyHighWaterMarkCodeLength = 281; -static const JSC::Intrinsic s_countQueuingStrategyHighWaterMarkCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_countQueuingStrategyHighWaterMarkCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const highWaterMark = @getByIdDirectPrivate(this, \"highWaterMark\");\n" \ - " if (highWaterMark === @undefined)\n" \ - " @throwTypeError(\"CountQueuingStrategy.highWaterMark getter called on incompatible |this| value.\");\n" \ - "\n" \ - " return highWaterMark;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_countQueuingStrategySizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_countQueuingStrategySizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_countQueuingStrategySizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_countQueuingStrategySizeCodeLength = 51; -static const JSC::Intrinsic s_countQueuingStrategySizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_countQueuingStrategySizeCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " return 1;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_countQueuingStrategyInitializeCountQueuingStrategyCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_countQueuingStrategyInitializeCountQueuingStrategyCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_countQueuingStrategyInitializeCountQueuingStrategyCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_countQueuingStrategyInitializeCountQueuingStrategyCodeLength = 155; -static const JSC::Intrinsic s_countQueuingStrategyInitializeCountQueuingStrategyCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_countQueuingStrategyInitializeCountQueuingStrategyCode = - "(function (parameters)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @putByIdDirectPrivate(this, \"highWaterMark\", @extractHighWaterMarkFromQueuingStrategyInit(parameters));\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().countQueuingStrategyBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().countQueuingStrategyBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/CountQueuingStrategyBuiltins.h b/src/bun.js/builtins/cpp/CountQueuingStrategyBuiltins.h deleted file mode 100644 index b03125a76..000000000 --- a/src/bun.js/builtins/cpp/CountQueuingStrategyBuiltins.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* CountQueuingStrategy */ -extern const char* const s_countQueuingStrategyHighWaterMarkCode; -extern const int s_countQueuingStrategyHighWaterMarkCodeLength; -extern const JSC::ConstructAbility s_countQueuingStrategyHighWaterMarkCodeConstructAbility; -extern const JSC::ConstructorKind s_countQueuingStrategyHighWaterMarkCodeConstructorKind; -extern const JSC::ImplementationVisibility s_countQueuingStrategyHighWaterMarkCodeImplementationVisibility; -extern const char* const s_countQueuingStrategySizeCode; -extern const int s_countQueuingStrategySizeCodeLength; -extern const JSC::ConstructAbility s_countQueuingStrategySizeCodeConstructAbility; -extern const JSC::ConstructorKind s_countQueuingStrategySizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_countQueuingStrategySizeCodeImplementationVisibility; -extern const char* const s_countQueuingStrategyInitializeCountQueuingStrategyCode; -extern const int s_countQueuingStrategyInitializeCountQueuingStrategyCodeLength; -extern const JSC::ConstructAbility s_countQueuingStrategyInitializeCountQueuingStrategyCodeConstructAbility; -extern const JSC::ConstructorKind s_countQueuingStrategyInitializeCountQueuingStrategyCodeConstructorKind; -extern const JSC::ImplementationVisibility s_countQueuingStrategyInitializeCountQueuingStrategyCodeImplementationVisibility; - -#define WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_DATA(macro) \ - macro(highWaterMark, countQueuingStrategyHighWaterMark, 0) \ - macro(size, countQueuingStrategySize, 0) \ - macro(initializeCountQueuingStrategy, countQueuingStrategyInitializeCountQueuingStrategy, 1) \ - -#define WEBCORE_BUILTIN_COUNTQUEUINGSTRATEGY_HIGHWATERMARK 1 -#define WEBCORE_BUILTIN_COUNTQUEUINGSTRATEGY_SIZE 1 -#define WEBCORE_BUILTIN_COUNTQUEUINGSTRATEGY_INITIALIZECOUNTQUEUINGSTRATEGY 1 - -#define WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_CODE(macro) \ - macro(countQueuingStrategyHighWaterMarkCode, highWaterMark, "get highWaterMark"_s, s_countQueuingStrategyHighWaterMarkCodeLength) \ - macro(countQueuingStrategySizeCode, size, ASCIILiteral(), s_countQueuingStrategySizeCodeLength) \ - macro(countQueuingStrategyInitializeCountQueuingStrategyCode, initializeCountQueuingStrategy, ASCIILiteral(), s_countQueuingStrategyInitializeCountQueuingStrategyCodeLength) \ - -#define WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(macro) \ - macro(highWaterMark) \ - macro(initializeCountQueuingStrategy) \ - macro(size) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class CountQueuingStrategyBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit CountQueuingStrategyBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* CountQueuingStrategyBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void CountQueuingStrategyBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_COUNTQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ImportMetaObjectBuiltins.cpp b/src/bun.js/builtins/cpp/ImportMetaObjectBuiltins.cpp deleted file mode 100644 index 83a2ba8c2..000000000 --- a/src/bun.js/builtins/cpp/ImportMetaObjectBuiltins.cpp +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "ImportMetaObjectBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_importMetaObjectLoadCJS2ESMCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_importMetaObjectLoadCJS2ESMCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_importMetaObjectLoadCJS2ESMCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_importMetaObjectLoadCJS2ESMCodeLength = 2943; -static const JSC::Intrinsic s_importMetaObjectLoadCJS2ESMCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_importMetaObjectLoadCJS2ESMCode = - "(function (resolvedSpecifier) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " var loader = @Loader;\n" \ - " var queue = @createFIFO();\n" \ - " var key = resolvedSpecifier;\n" \ - " while (key) {\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " var entry = loader.registry.@get(key);\n" \ - "\n" \ - " if (!entry || !entry.state || entry.state <= @ModuleFetch) {\n" \ - " @fulfillModuleSync(key);\n" \ - " entry = loader.registry.@get(key);\n" \ - " }\n" \ - "\n" \ - "\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " var sourceCodeObject = @getPromiseInternalField(\n" \ - " entry.fetch,\n" \ - " @promiseFieldReactionsOrResult\n" \ - " );\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " var moduleRecordPromise = loader.parseModule(key, sourceCodeObject);\n" \ - " var module = entry.module;\n" \ - " if (!module && moduleRecordPromise && @isPromise(moduleRecordPromise)) {\n" \ - " var reactionsOrResult = @getPromiseInternalField(\n" \ - " moduleRecordPromise,\n" \ - " @promiseFieldReactionsOrResult\n" \ - " );\n" \ - " var flags = @getPromiseInternalField(\n" \ - " moduleRecordPromise,\n" \ - " @promiseFieldFlags\n" \ - " );\n" \ - " var state = flags & @promiseStateMask;\n" \ - " //\n" \ - " if (\n" \ - " state === @promiseStatePending ||\n" \ - " (reactionsOrResult && @isPromise(reactionsOrResult))\n" \ - " ) {\n" \ - " @throwTypeError(`require() async module \\\"${key}\\\" is unsupported`);\n" \ - " } else if (state === @promiseStateRejected) {\n" \ - " //\n" \ - " //\n" \ - " @throwTypeError(\n" \ - " `${\n" \ - " reactionsOrResult?.message ?? \"An error occurred\"\n" \ - " } while parsing module \\\"${key}\\\"`\n" \ - " );\n" \ - " }\n" \ - " entry.module = module = reactionsOrResult;\n" \ - " } else if (moduleRecordPromise && !module) {\n" \ - " entry.module = module = moduleRecordPromise;\n" \ - " }\n" \ - "\n" \ - " //\n" \ - " @setStateToMax(entry, @ModuleLink);\n" \ - " var dependenciesMap = module.dependenciesMap;\n" \ - " var requestedModules = loader.requestedModules(module);\n" \ - " var dependencies = @newArrayWithSize(requestedModules.length);\n" \ - " for (var i = 0, length = requestedModules.length; i < length; ++i) {\n" \ - " var depName = requestedModules[i];\n" \ - " //\n" \ - " //\n" \ - " var depKey =\n" \ - " depName[0] === \"/\"\n" \ - " ? depName\n" \ - " : loader.resolve(depName, key, @undefined);\n" \ - " var depEntry = loader.ensureRegistered(depKey);\n" \ - " if (depEntry.state < @ModuleLink) {\n" \ - " queue.push(depKey);\n" \ - " }\n" \ - "\n" \ - " @putByValDirect(dependencies, i, depEntry);\n" \ - " dependenciesMap.@set(depName, depEntry);\n" \ - " }\n" \ - "\n" \ - " entry.dependencies = dependencies;\n" \ - " //\n" \ - " entry.instantiate = @Promise.resolve(entry)\n" \ - " entry.satisfy = @Promise.resolve(entry);\n" \ - " key = queue.shift();\n" \ - " while (key && (loader.registry.@get(key)?.state ?? @ModuleFetch) >= @ModuleLink) {\n" \ - " key = queue.shift();\n" \ - " }\n" \ - "\n" \ - " }\n" \ - "\n" \ - " var linkAndEvaluateResult = loader.linkAndEvaluateModule(\n" \ - " resolvedSpecifier,\n" \ - " @undefined\n" \ - " );\n" \ - " if (linkAndEvaluateResult && @isPromise(linkAndEvaluateResult)) {\n" \ - " //\n" \ - " //\n" \ - " @throwTypeError(\n" \ - " `require() async module \\\"${resolvedSpecifier}\\\" is unsupported`\n" \ - " );\n" \ - " }\n" \ - "\n" \ - " return loader.registry.@get(resolvedSpecifier);\n" \ - "\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_importMetaObjectRequireESMCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_importMetaObjectRequireESMCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_importMetaObjectRequireESMCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_importMetaObjectRequireESMCodeLength = 616; -static const JSC::Intrinsic s_importMetaObjectRequireESMCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_importMetaObjectRequireESMCode = - "(function (resolved) {\n" \ - " \"use strict\";\n" \ - " var entry = @Loader.registry.@get(resolved);\n" \ - "\n" \ - " if (!entry || !entry.evaluated) {\n" \ - " entry = @loadCJS2ESM(resolved); \n" \ - " }\n" \ - "\n" \ - " if (!entry || !entry.evaluated || !entry.module) {\n" \ - " @throwTypeError(`require() failed to evaluate module \\\"${resolved}\\\". This is an internal consistentency error.`);\n" \ - " }\n" \ - " var exports = @Loader.getModuleNamespaceObject(entry.module);\n" \ - " var commonJS = exports.default;\n" \ - " var cjs = commonJS?.[@commonJSSymbol];\n" \ - " if (cjs === 0) {\n" \ - " return commonJS;\n" \ - " } else if (cjs && @isCallable(commonJS)) {\n" \ - " return commonJS();\n" \ - " }\n" \ - " \n" \ - " return exports;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_importMetaObjectInternalRequireCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_importMetaObjectInternalRequireCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_importMetaObjectInternalRequireCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_importMetaObjectInternalRequireCodeLength = 983; -static const JSC::Intrinsic s_importMetaObjectInternalRequireCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_importMetaObjectInternalRequireCode = - "(function (resolved) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " var cached = @requireMap.@get(resolved);\n" \ - " const last5 = resolved.substring(resolved.length - 5);\n" \ - " if (cached) {\n" \ - " if (last5 === \".node\") {\n" \ - " return cached.exports;\n" \ - " }\n" \ - "\n" \ - " return cached;\n" \ - " }\n" \ - " \n" \ - " //\n" \ - " if (last5 === \".json\") {\n" \ - " var fs = (globalThis[Symbol.for(\"_fs\")] ||= @Bun.fs());\n" \ - " var exports = JSON.parse(fs.readFileSync(resolved, \"utf8\"));\n" \ - " @requireMap.@set(resolved, exports);\n" \ - " return exports;\n" \ - " } else if (last5 === \".node\") {\n" \ - " var module = { exports: {} };\n" \ - " process.dlopen(module, resolved);\n" \ - " @requireMap.@set(resolved, module);\n" \ - " return module.exports;\n" \ - " } else if (last5 === \".toml\") {\n" \ - " var fs = (globalThis[Symbol.for(\"_fs\")] ||= @Bun.fs());\n" \ - " var exports = @Bun.TOML.parse(fs.readFileSync(resolved, \"utf8\"));\n" \ - " @requireMap.@set(resolved, exports);\n" \ - " return exports;\n" \ - " } else {\n" \ - " var exports = @requireESM(resolved);\n" \ - " @requireMap.@set(resolved, exports);\n" \ - " return exports;\n" \ - " }\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_importMetaObjectRequireCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_importMetaObjectRequireCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_importMetaObjectRequireCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_importMetaObjectRequireCodeLength = 222; -static const JSC::Intrinsic s_importMetaObjectRequireCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_importMetaObjectRequireCode = - "(function (name) {\n" \ - " const from = this?.path ?? arguments.callee.path;\n" \ - "\n" \ - " if (typeof name !== \"string\") {\n" \ - " @throwTypeError(\"require(name) must be a string\");\n" \ - " }\n" \ - "\n" \ - " return @internalRequire(@resolveSync(name, from));\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_importMetaObjectMainCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_importMetaObjectMainCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_importMetaObjectMainCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_importMetaObjectMainCodeLength = 52; -static const JSC::Intrinsic s_importMetaObjectMainCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_importMetaObjectMainCode = - "(function () {\n" \ - " return this.path === @Bun.main;\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().importMetaObjectBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().importMetaObjectBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ImportMetaObjectBuiltins.h b/src/bun.js/builtins/cpp/ImportMetaObjectBuiltins.h deleted file mode 100644 index b5a4f6e6b..000000000 --- a/src/bun.js/builtins/cpp/ImportMetaObjectBuiltins.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* ImportMetaObject */ -extern const char* const s_importMetaObjectLoadCJS2ESMCode; -extern const int s_importMetaObjectLoadCJS2ESMCodeLength; -extern const JSC::ConstructAbility s_importMetaObjectLoadCJS2ESMCodeConstructAbility; -extern const JSC::ConstructorKind s_importMetaObjectLoadCJS2ESMCodeConstructorKind; -extern const JSC::ImplementationVisibility s_importMetaObjectLoadCJS2ESMCodeImplementationVisibility; -extern const char* const s_importMetaObjectRequireESMCode; -extern const int s_importMetaObjectRequireESMCodeLength; -extern const JSC::ConstructAbility s_importMetaObjectRequireESMCodeConstructAbility; -extern const JSC::ConstructorKind s_importMetaObjectRequireESMCodeConstructorKind; -extern const JSC::ImplementationVisibility s_importMetaObjectRequireESMCodeImplementationVisibility; -extern const char* const s_importMetaObjectInternalRequireCode; -extern const int s_importMetaObjectInternalRequireCodeLength; -extern const JSC::ConstructAbility s_importMetaObjectInternalRequireCodeConstructAbility; -extern const JSC::ConstructorKind s_importMetaObjectInternalRequireCodeConstructorKind; -extern const JSC::ImplementationVisibility s_importMetaObjectInternalRequireCodeImplementationVisibility; -extern const char* const s_importMetaObjectRequireCode; -extern const int s_importMetaObjectRequireCodeLength; -extern const JSC::ConstructAbility s_importMetaObjectRequireCodeConstructAbility; -extern const JSC::ConstructorKind s_importMetaObjectRequireCodeConstructorKind; -extern const JSC::ImplementationVisibility s_importMetaObjectRequireCodeImplementationVisibility; -extern const char* const s_importMetaObjectMainCode; -extern const int s_importMetaObjectMainCodeLength; -extern const JSC::ConstructAbility s_importMetaObjectMainCodeConstructAbility; -extern const JSC::ConstructorKind s_importMetaObjectMainCodeConstructorKind; -extern const JSC::ImplementationVisibility s_importMetaObjectMainCodeImplementationVisibility; - -#define WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_DATA(macro) \ - macro(loadCJS2ESM, importMetaObjectLoadCJS2ESM, 1) \ - macro(requireESM, importMetaObjectRequireESM, 1) \ - macro(internalRequire, importMetaObjectInternalRequire, 1) \ - macro(require, importMetaObjectRequire, 1) \ - macro(main, importMetaObjectMain, 0) \ - -#define WEBCORE_BUILTIN_IMPORTMETAOBJECT_LOADCJS2ESM 1 -#define WEBCORE_BUILTIN_IMPORTMETAOBJECT_REQUIREESM 1 -#define WEBCORE_BUILTIN_IMPORTMETAOBJECT_INTERNALREQUIRE 1 -#define WEBCORE_BUILTIN_IMPORTMETAOBJECT_REQUIRE 1 -#define WEBCORE_BUILTIN_IMPORTMETAOBJECT_MAIN 1 - -#define WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_CODE(macro) \ - macro(importMetaObjectLoadCJS2ESMCode, loadCJS2ESM, ASCIILiteral(), s_importMetaObjectLoadCJS2ESMCodeLength) \ - macro(importMetaObjectRequireESMCode, requireESM, ASCIILiteral(), s_importMetaObjectRequireESMCodeLength) \ - macro(importMetaObjectInternalRequireCode, internalRequire, ASCIILiteral(), s_importMetaObjectInternalRequireCodeLength) \ - macro(importMetaObjectRequireCode, require, ASCIILiteral(), s_importMetaObjectRequireCodeLength) \ - macro(importMetaObjectMainCode, main, "get main"_s, s_importMetaObjectMainCodeLength) \ - -#define WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_FUNCTION_NAME(macro) \ - macro(internalRequire) \ - macro(loadCJS2ESM) \ - macro(main) \ - macro(require) \ - macro(requireESM) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ImportMetaObjectBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ImportMetaObjectBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ImportMetaObjectBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ImportMetaObjectBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_IMPORTMETAOBJECT_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/JSBufferConstructorBuiltins.cpp b/src/bun.js/builtins/cpp/JSBufferConstructorBuiltins.cpp deleted file mode 100644 index 6e663afce..000000000 --- a/src/bun.js/builtins/cpp/JSBufferConstructorBuiltins.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "JSBufferConstructorBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_jsBufferConstructorFromCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferConstructorFromCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferConstructorFromCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferConstructorFromCodeLength = 1762; -static const JSC::Intrinsic s_jsBufferConstructorFromCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferConstructorFromCode = - "(function (items) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (@isUndefinedOrNull(items)) {\n" \ - " @throwTypeError(\n" \ - " \"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object.\",\n" \ - " );\n" \ - " }\n" \ - " \n" \ - "\n" \ - " //\n" \ - " if (\n" \ - " typeof items === \"string\" ||\n" \ - " (typeof items === \"object\" &&\n" \ - " (@isTypedArrayView(items) ||\n" \ - " items instanceof ArrayBuffer ||\n" \ - " items instanceof SharedArrayBuffer ||\n" \ - " items instanceof @String))\n" \ - " ) {\n" \ - " switch (@argumentCount()) {\n" \ - " case 1: {\n" \ - " return new @Buffer(items);\n" \ - " }\n" \ - " case 2: {\n" \ - " return new @Buffer(items, @argument(1));\n" \ - " }\n" \ - " default: {\n" \ - " return new @Buffer(items, @argument(1), @argument(2));\n" \ - " }\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " var arrayLike = @toObject(\n" \ - " items,\n" \ - " \"The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object.\",\n" \ - " );\n" \ - "\n" \ - " if (!@isJSArray(arrayLike)) {\n" \ - " const toPrimitive = @tryGetByIdWithWellKnownSymbol(items, \"toPrimitive\");\n" \ - "\n" \ - " if (toPrimitive) {\n" \ - " const primitive = toPrimitive.@call(items, \"string\");\n" \ - "\n" \ - " if (typeof primitive === \"string\") {\n" \ - " switch (@argumentCount()) {\n" \ - " case 1: {\n" \ - " return new @Buffer(primitive);\n" \ - " }\n" \ - " case 2: {\n" \ - " return new @Buffer(primitive, @argument(1));\n" \ - " }\n" \ - " default: {\n" \ - " return new @Buffer(primitive, @argument(1), @argument(2));\n" \ - " }\n" \ - " }\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " if (!(\"length\" in arrayLike) || @isCallable(arrayLike)) {\n" \ - " @throwTypeError(\n" \ - " \"The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object.\",\n" \ - " );\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " return new @Buffer(@Uint8Array.from(arrayLike).buffer);\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().jsBufferConstructorBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().jsBufferConstructorBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/JSBufferConstructorBuiltins.h b/src/bun.js/builtins/cpp/JSBufferConstructorBuiltins.h deleted file mode 100644 index da990268b..000000000 --- a/src/bun.js/builtins/cpp/JSBufferConstructorBuiltins.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* JSBufferConstructor */ -extern const char* const s_jsBufferConstructorFromCode; -extern const int s_jsBufferConstructorFromCodeLength; -extern const JSC::ConstructAbility s_jsBufferConstructorFromCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferConstructorFromCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferConstructorFromCodeImplementationVisibility; - -#define WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_DATA(macro) \ - macro(from, jsBufferConstructorFrom, 1) \ - -#define WEBCORE_BUILTIN_JSBUFFERCONSTRUCTOR_FROM 1 - -#define WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_CODE(macro) \ - macro(jsBufferConstructorFromCode, from, ASCIILiteral(), s_jsBufferConstructorFromCodeLength) \ - -#define WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_FUNCTION_NAME(macro) \ - macro(from) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class JSBufferConstructorBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit JSBufferConstructorBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* JSBufferConstructorBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void JSBufferConstructorBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_JSBUFFERCONSTRUCTOR_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.cpp b/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.cpp deleted file mode 100644 index 19ce8a395..000000000 --- a/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.cpp +++ /dev/null @@ -1,1114 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "JSBufferPrototypeBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_jsBufferPrototypeSetBigUint64CodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeSetBigUint64CodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeSetBigUint64CodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeSetBigUint64CodeLength = 174; -static const JSC::Intrinsic s_jsBufferPrototypeSetBigUint64CodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeSetBigUint64Code = - "(function (offset, value, le) {\n" \ - " \"use strict\";\n" \ - " return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setBigUint64(offset, value, le);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadInt8CodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadInt8CodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt8CodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadInt8CodeLength = 147; -static const JSC::Intrinsic s_jsBufferPrototypeReadInt8CodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadInt8Code = - "(function (offset) {\n" \ - " \"use strict\";\n" \ - " return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getInt8(offset);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadUInt8CodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadUInt8CodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt8CodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadUInt8CodeLength = 148; -static const JSC::Intrinsic s_jsBufferPrototypeReadUInt8CodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadUInt8Code = - "(function (offset) {\n" \ - " \"use strict\";\n" \ - " return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getUint8(offset);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadInt16LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadInt16LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt16LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadInt16LECodeLength = 154; -static const JSC::Intrinsic s_jsBufferPrototypeReadInt16LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadInt16LECode = - "(function (offset) {\n" \ - " \"use strict\";\n" \ - " return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getInt16(offset, true);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadInt16BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadInt16BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt16BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadInt16BECodeLength = 155; -static const JSC::Intrinsic s_jsBufferPrototypeReadInt16BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadInt16BECode = - "(function (offset) {\n" \ - " \"use strict\";\n" \ - " return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getInt16(offset, false);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadUInt16LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadUInt16LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt16LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadUInt16LECodeLength = 155; -static const JSC::Intrinsic s_jsBufferPrototypeReadUInt16LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadUInt16LECode = - "(function (offset) {\n" \ - " \"use strict\";\n" \ - " return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getUint16(offset, true);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadUInt16BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadUInt16BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt16BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadUInt16BECodeLength = 156; -static const JSC::Intrinsic s_jsBufferPrototypeReadUInt16BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadUInt16BECode = - "(function (offset) {\n" \ - " \"use strict\";\n" \ - " return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getUint16(offset, false);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadInt32LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadInt32LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt32LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadInt32LECodeLength = 154; -static const JSC::Intrinsic s_jsBufferPrototypeReadInt32LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadInt32LECode = - "(function (offset) {\n" \ - " \"use strict\";\n" \ - " return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getInt32(offset, true);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadInt32BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadInt32BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt32BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadInt32BECodeLength = 155; -static const JSC::Intrinsic s_jsBufferPrototypeReadInt32BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadInt32BECode = - "(function (offset) {\n" \ - " \"use strict\";\n" \ - " return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getInt32(offset, false);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadUInt32LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadUInt32LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt32LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadUInt32LECodeLength = 155; -static const JSC::Intrinsic s_jsBufferPrototypeReadUInt32LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadUInt32LECode = - "(function (offset) {\n" \ - " \"use strict\";\n" \ - " return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getUint32(offset, true);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadUInt32BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadUInt32BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt32BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadUInt32BECodeLength = 156; -static const JSC::Intrinsic s_jsBufferPrototypeReadUInt32BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadUInt32BECode = - "(function (offset) {\n" \ - " \"use strict\";\n" \ - " return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getUint32(offset, false);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadIntLECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadIntLECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadIntLECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadIntLECodeLength = 882; -static const JSC::Intrinsic s_jsBufferPrototypeReadIntLECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadIntLECode = - "(function (offset, byteLength) {\n" \ - " \"use strict\";\n" \ - " const view = this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength);\n" \ - " switch (byteLength) {\n" \ - " case 1: {\n" \ - " return view.getInt8(offset);\n" \ - " }\n" \ - " case 2: {\n" \ - " return view.getInt16(offset, true);\n" \ - " }\n" \ - " case 3: {\n" \ - " const val = view.getUint16(offset, true) + view.getUint8(offset + 2) * 2 ** 16;\n" \ - " return val | (val & 2 ** 23) * 0x1fe;\n" \ - " }\n" \ - " case 4: {\n" \ - " return view.getInt32(offset, true);\n" \ - " }\n" \ - " case 5: {\n" \ - " const last = view.getUint8(offset + 4);\n" \ - " return (last | (last & 2 ** 7) * 0x1fffffe) * 2 ** 32 + view.getUint32(offset, true);\n" \ - " }\n" \ - " case 6: {\n" \ - " const last = view.getUint16(offset + 4, true);\n" \ - " return (last | (last & 2 ** 15) * 0x1fffe) * 2 ** 32 + view.getUint32(offset, true);\n" \ - " }\n" \ - " }\n" \ - " @throwRangeError(\"byteLength must be >= 1 and <= 6\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadIntBECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadIntBECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadIntBECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadIntBECodeLength = 888; -static const JSC::Intrinsic s_jsBufferPrototypeReadIntBECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadIntBECode = - "(function (offset, byteLength) {\n" \ - " \"use strict\";\n" \ - " const view = this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength);\n" \ - " switch (byteLength) {\n" \ - " case 1: {\n" \ - " return view.getInt8(offset);\n" \ - " }\n" \ - " case 2: {\n" \ - " return view.getInt16(offset, false);\n" \ - " }\n" \ - " case 3: {\n" \ - " const val = view.getUint16(offset + 1, false) + view.getUint8(offset) * 2 ** 16;\n" \ - " return val | (val & 2 ** 23) * 0x1fe;\n" \ - " }\n" \ - " case 4: {\n" \ - " return view.getInt32(offset, false);\n" \ - " }\n" \ - " case 5: {\n" \ - " const last = view.getUint8(offset);\n" \ - " return (last | (last & 2 ** 7) * 0x1fffffe) * 2 ** 32 + view.getUint32(offset + 1, false);\n" \ - " }\n" \ - " case 6: {\n" \ - " const last = view.getUint16(offset, false);\n" \ - " return (last | (last & 2 ** 15) * 0x1fffe) * 2 ** 32 + view.getUint32(offset + 2, false);\n" \ - " }\n" \ - " }\n" \ - " @throwRangeError(\"byteLength must be >= 1 and <= 6\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadUIntLECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadUIntLECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadUIntLECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadUIntLECodeLength = 723; -static const JSC::Intrinsic s_jsBufferPrototypeReadUIntLECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadUIntLECode = - "(function (offset, byteLength) {\n" \ - " \"use strict\";\n" \ - " const view = this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength);\n" \ - " switch (byteLength) {\n" \ - " case 1: {\n" \ - " return view.getUint8(offset);\n" \ - " }\n" \ - " case 2: {\n" \ - " return view.getUint16(offset, true);\n" \ - " }\n" \ - " case 3: {\n" \ - " return view.getUint16(offset, true) + view.getUint8(offset + 2) * 2 ** 16;\n" \ - " }\n" \ - " case 4: {\n" \ - " return view.getUint32(offset, true);\n" \ - " }\n" \ - " case 5: {\n" \ - " return view.getUint8(offset + 4) * 2 ** 32 + view.getUint32(offset, true);\n" \ - " }\n" \ - " case 6: {\n" \ - " return view.getUint16(offset + 4, true) * 2 ** 32 + view.getUint32(offset, true);\n" \ - " }\n" \ - " }\n" \ - " @throwRangeError(\"byteLength must be >= 1 and <= 6\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeInspectCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeInspectCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeInspectCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeInspectCodeLength = 81; -static const JSC::Intrinsic s_jsBufferPrototypeInspectCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeInspectCode = - "(function (recurseTimes, ctx) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " return @Bun.inspect(this);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadUIntBECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadUIntBECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadUIntBECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadUIntBECodeLength = 842; -static const JSC::Intrinsic s_jsBufferPrototypeReadUIntBECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadUIntBECode = - "(function (offset, byteLength) {\n" \ - " \"use strict\";\n" \ - " const view = this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength);\n" \ - " switch (byteLength) {\n" \ - " case 1: {\n" \ - " return view.getUint8(offset);\n" \ - " }\n" \ - " case 2: {\n" \ - " return view.getUint16(offset, false);\n" \ - " }\n" \ - " case 3: {\n" \ - " return view.getUint16(offset + 1, false) + view.getUint8(offset) * 2 ** 16;\n" \ - " }\n" \ - " case 4: {\n" \ - " return view.getUint32(offset, false);\n" \ - " }\n" \ - " case 5: {\n" \ - " const last = view.getUint8(offset);\n" \ - " return (last | (last & 2 ** 7) * 0x1fffffe) * 2 ** 32 + view.getUint32(offset + 1, false);\n" \ - " }\n" \ - " case 6: {\n" \ - " const last = view.getUint16(offset, false);\n" \ - " return (last | (last & 2 ** 15) * 0x1fffe) * 2 ** 32 + view.getUint32(offset + 2, false);\n" \ - " }\n" \ - " }\n" \ - " @throwRangeError(\"byteLength must be >= 1 and <= 6\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadFloatLECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadFloatLECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadFloatLECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadFloatLECodeLength = 156; -static const JSC::Intrinsic s_jsBufferPrototypeReadFloatLECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadFloatLECode = - "(function (offset) {\n" \ - " \"use strict\";\n" \ - " return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getFloat32(offset, true);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadFloatBECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadFloatBECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadFloatBECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadFloatBECodeLength = 157; -static const JSC::Intrinsic s_jsBufferPrototypeReadFloatBECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadFloatBECode = - "(function (offset) {\n" \ - " \"use strict\";\n" \ - " return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getFloat32(offset, false);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadDoubleLECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadDoubleLECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadDoubleLECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadDoubleLECodeLength = 156; -static const JSC::Intrinsic s_jsBufferPrototypeReadDoubleLECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadDoubleLECode = - "(function (offset) {\n" \ - " \"use strict\";\n" \ - " return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getFloat64(offset, true);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadDoubleBECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadDoubleBECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadDoubleBECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadDoubleBECodeLength = 157; -static const JSC::Intrinsic s_jsBufferPrototypeReadDoubleBECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadDoubleBECode = - "(function (offset) {\n" \ - " \"use strict\";\n" \ - " return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getFloat64(offset, false);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadBigInt64LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadBigInt64LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadBigInt64LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadBigInt64LECodeLength = 157; -static const JSC::Intrinsic s_jsBufferPrototypeReadBigInt64LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadBigInt64LECode = - "(function (offset) {\n" \ - " \"use strict\";\n" \ - " return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getBigInt64(offset, true);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadBigInt64BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadBigInt64BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadBigInt64BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadBigInt64BECodeLength = 158; -static const JSC::Intrinsic s_jsBufferPrototypeReadBigInt64BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadBigInt64BECode = - "(function (offset) {\n" \ - " \"use strict\";\n" \ - " return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getBigInt64(offset, false);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadBigUInt64LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadBigUInt64LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadBigUInt64LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadBigUInt64LECodeLength = 158; -static const JSC::Intrinsic s_jsBufferPrototypeReadBigUInt64LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadBigUInt64LECode = - "(function (offset) {\n" \ - " \"use strict\";\n" \ - " return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getBigUint64(offset, true);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeReadBigUInt64BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeReadBigUInt64BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeReadBigUInt64BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeReadBigUInt64BECodeLength = 159; -static const JSC::Intrinsic s_jsBufferPrototypeReadBigUInt64BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeReadBigUInt64BECode = - "(function (offset) {\n" \ - " \"use strict\";\n" \ - " return (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).getBigUint64(offset, false);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteInt8CodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteInt8CodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt8CodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteInt8CodeLength = 175; -static const JSC::Intrinsic s_jsBufferPrototypeWriteInt8CodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteInt8Code = - "(function (value, offset) {\n" \ - " \"use strict\";\n" \ - " (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setInt8(offset, value);\n" \ - " return offset + 1;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt8CodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt8CodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt8CodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteUInt8CodeLength = 176; -static const JSC::Intrinsic s_jsBufferPrototypeWriteUInt8CodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteUInt8Code = - "(function (value, offset) {\n" \ - " \"use strict\";\n" \ - " (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setUint8(offset, value);\n" \ - " return offset + 1;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteInt16LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteInt16LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt16LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteInt16LECodeLength = 182; -static const JSC::Intrinsic s_jsBufferPrototypeWriteInt16LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteInt16LECode = - "(function (value, offset) {\n" \ - " \"use strict\";\n" \ - " (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setInt16(offset, value, true);\n" \ - " return offset + 2;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteInt16BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteInt16BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt16BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteInt16BECodeLength = 183; -static const JSC::Intrinsic s_jsBufferPrototypeWriteInt16BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteInt16BECode = - "(function (value, offset) {\n" \ - " \"use strict\";\n" \ - " (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setInt16(offset, value, false);\n" \ - " return offset + 2;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt16LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt16LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt16LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteUInt16LECodeLength = 183; -static const JSC::Intrinsic s_jsBufferPrototypeWriteUInt16LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteUInt16LECode = - "(function (value, offset) {\n" \ - " \"use strict\";\n" \ - " (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setUint16(offset, value, true);\n" \ - " return offset + 2;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt16BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt16BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt16BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteUInt16BECodeLength = 184; -static const JSC::Intrinsic s_jsBufferPrototypeWriteUInt16BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteUInt16BECode = - "(function (value, offset) {\n" \ - " \"use strict\";\n" \ - " (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setUint16(offset, value, false);\n" \ - " return offset + 2;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteInt32LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteInt32LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt32LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteInt32LECodeLength = 182; -static const JSC::Intrinsic s_jsBufferPrototypeWriteInt32LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteInt32LECode = - "(function (value, offset) {\n" \ - " \"use strict\";\n" \ - " (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setInt32(offset, value, true);\n" \ - " return offset + 4;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteInt32BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteInt32BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt32BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteInt32BECodeLength = 183; -static const JSC::Intrinsic s_jsBufferPrototypeWriteInt32BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteInt32BECode = - "(function (value, offset) {\n" \ - " \"use strict\";\n" \ - " (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setInt32(offset, value, false);\n" \ - " return offset + 4;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt32LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt32LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt32LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteUInt32LECodeLength = 183; -static const JSC::Intrinsic s_jsBufferPrototypeWriteUInt32LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteUInt32LECode = - "(function (value, offset) {\n" \ - " \"use strict\";\n" \ - " (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setUint32(offset, value, true);\n" \ - " return offset + 4;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt32BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt32BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt32BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteUInt32BECodeLength = 184; -static const JSC::Intrinsic s_jsBufferPrototypeWriteUInt32BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteUInt32BECode = - "(function (value, offset) {\n" \ - " \"use strict\";\n" \ - " (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setUint32(offset, value, false);\n" \ - " return offset + 4;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteIntLECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteIntLECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteIntLECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteIntLECodeLength = 949; -static const JSC::Intrinsic s_jsBufferPrototypeWriteIntLECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteIntLECode = - "(function (value, offset, byteLength) {\n" \ - " \"use strict\";\n" \ - " const view = this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength);\n" \ - " switch (byteLength) {\n" \ - " case 1: {\n" \ - " view.setInt8(offset, value);\n" \ - " break;\n" \ - " }\n" \ - " case 2: {\n" \ - " view.setInt16(offset, value, true);\n" \ - " break;\n" \ - " }\n" \ - " case 3: {\n" \ - " view.setUint16(offset, value & 0xFFFF, true);\n" \ - " view.setInt8(offset + 2, Math.floor(value * 2 ** -16));\n" \ - " break;\n" \ - " }\n" \ - " case 4: {\n" \ - " view.setInt32(offset, value, true);\n" \ - " break;\n" \ - " }\n" \ - " case 5: {\n" \ - " view.setUint32(offset, value | 0, true);\n" \ - " view.setInt8(offset + 4, Math.floor(value * 2 ** -32));\n" \ - " break;\n" \ - " }\n" \ - " case 6: {\n" \ - " view.setUint32(offset, value | 0, true);\n" \ - " view.setInt16(offset + 4, Math.floor(value * 2 ** -32), true);\n" \ - " break;\n" \ - " }\n" \ - " default: {\n" \ - " @throwRangeError(\"byteLength must be >= 1 and <= 6\");\n" \ - " }\n" \ - " }\n" \ - " return offset + byteLength;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteIntBECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteIntBECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteIntBECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteIntBECodeLength = 955; -static const JSC::Intrinsic s_jsBufferPrototypeWriteIntBECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteIntBECode = - "(function (value, offset, byteLength) {\n" \ - " \"use strict\";\n" \ - " const view = this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength);\n" \ - " switch (byteLength) {\n" \ - " case 1: {\n" \ - " view.setInt8(offset, value);\n" \ - " break;\n" \ - " }\n" \ - " case 2: {\n" \ - " view.setInt16(offset, value, false);\n" \ - " break;\n" \ - " }\n" \ - " case 3: {\n" \ - " view.setUint16(offset + 1, value & 0xFFFF, false);\n" \ - " view.setInt8(offset, Math.floor(value * 2 ** -16));\n" \ - " break;\n" \ - " }\n" \ - " case 4: {\n" \ - " view.setInt32(offset, value, false);\n" \ - " break;\n" \ - " }\n" \ - " case 5: {\n" \ - " view.setUint32(offset + 1, value | 0, false);\n" \ - " view.setInt8(offset, Math.floor(value * 2 ** -32));\n" \ - " break;\n" \ - " }\n" \ - " case 6: {\n" \ - " view.setUint32(offset + 2, value | 0, false);\n" \ - " view.setInt16(offset, Math.floor(value * 2 ** -32), false);\n" \ - " break;\n" \ - " }\n" \ - " default: {\n" \ - " @throwRangeError(\"byteLength must be >= 1 and <= 6\");\n" \ - " }\n" \ - " }\n" \ - " return offset + byteLength;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteUIntLECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteUIntLECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUIntLECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteUIntLECodeLength = 955; -static const JSC::Intrinsic s_jsBufferPrototypeWriteUIntLECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteUIntLECode = - "(function (value, offset, byteLength) {\n" \ - " \"use strict\";\n" \ - " const view = this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength);\n" \ - " switch (byteLength) {\n" \ - " case 1: {\n" \ - " view.setUint8(offset, value);\n" \ - " break;\n" \ - " }\n" \ - " case 2: {\n" \ - " view.setUint16(offset, value, true);\n" \ - " break;\n" \ - " }\n" \ - " case 3: {\n" \ - " view.setUint16(offset, value & 0xFFFF, true);\n" \ - " view.setUint8(offset + 2, Math.floor(value * 2 ** -16));\n" \ - " break;\n" \ - " }\n" \ - " case 4: {\n" \ - " view.setUint32(offset, value, true);\n" \ - " break;\n" \ - " }\n" \ - " case 5: {\n" \ - " view.setUint32(offset, value | 0, true);\n" \ - " view.setUint8(offset + 4, Math.floor(value * 2 ** -32));\n" \ - " break;\n" \ - " }\n" \ - " case 6: {\n" \ - " view.setUint32(offset, value | 0, true);\n" \ - " view.setUint16(offset + 4, Math.floor(value * 2 ** -32), true);\n" \ - " break;\n" \ - " }\n" \ - " default: {\n" \ - " @throwRangeError(\"byteLength must be >= 1 and <= 6\");\n" \ - " }\n" \ - " }\n" \ - " return offset + byteLength;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteUIntBECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteUIntBECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUIntBECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteUIntBECodeLength = 961; -static const JSC::Intrinsic s_jsBufferPrototypeWriteUIntBECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteUIntBECode = - "(function (value, offset, byteLength) {\n" \ - " \"use strict\";\n" \ - " const view = this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength);\n" \ - " switch (byteLength) {\n" \ - " case 1: {\n" \ - " view.setUint8(offset, value);\n" \ - " break;\n" \ - " }\n" \ - " case 2: {\n" \ - " view.setUint16(offset, value, false);\n" \ - " break;\n" \ - " }\n" \ - " case 3: {\n" \ - " view.setUint16(offset + 1, value & 0xFFFF, false);\n" \ - " view.setUint8(offset, Math.floor(value * 2 ** -16));\n" \ - " break;\n" \ - " }\n" \ - " case 4: {\n" \ - " view.setUint32(offset, value, false);\n" \ - " break;\n" \ - " }\n" \ - " case 5: {\n" \ - " view.setUint32(offset + 1, value | 0, false);\n" \ - " view.setUint8(offset, Math.floor(value * 2 ** -32));\n" \ - " break;\n" \ - " }\n" \ - " case 6: {\n" \ - " view.setUint32(offset + 2, value | 0, false);\n" \ - " view.setUint16(offset, Math.floor(value * 2 ** -32), false);\n" \ - " break;\n" \ - " }\n" \ - " default: {\n" \ - " @throwRangeError(\"byteLength must be >= 1 and <= 6\");\n" \ - " }\n" \ - " }\n" \ - " return offset + byteLength;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteFloatLECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteFloatLECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteFloatLECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteFloatLECodeLength = 184; -static const JSC::Intrinsic s_jsBufferPrototypeWriteFloatLECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteFloatLECode = - "(function (value, offset) {\n" \ - " \"use strict\";\n" \ - " (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setFloat32(offset, value, true);\n" \ - " return offset + 4;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteFloatBECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteFloatBECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteFloatBECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteFloatBECodeLength = 185; -static const JSC::Intrinsic s_jsBufferPrototypeWriteFloatBECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteFloatBECode = - "(function (value, offset) {\n" \ - " \"use strict\";\n" \ - " (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setFloat32(offset, value, false);\n" \ - " return offset + 4;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteDoubleLECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteDoubleLECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteDoubleLECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteDoubleLECodeLength = 184; -static const JSC::Intrinsic s_jsBufferPrototypeWriteDoubleLECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteDoubleLECode = - "(function (value, offset) {\n" \ - " \"use strict\";\n" \ - " (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setFloat64(offset, value, true);\n" \ - " return offset + 8;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteDoubleBECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteDoubleBECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteDoubleBECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteDoubleBECodeLength = 185; -static const JSC::Intrinsic s_jsBufferPrototypeWriteDoubleBECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteDoubleBECode = - "(function (value, offset) {\n" \ - " \"use strict\";\n" \ - " (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setFloat64(offset, value, false);\n" \ - " return offset + 8;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteBigInt64LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteBigInt64LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteBigInt64LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteBigInt64LECodeLength = 185; -static const JSC::Intrinsic s_jsBufferPrototypeWriteBigInt64LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteBigInt64LECode = - "(function (value, offset) {\n" \ - " \"use strict\";\n" \ - " (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setBigInt64(offset, value, true);\n" \ - " return offset + 8;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteBigInt64BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteBigInt64BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteBigInt64BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteBigInt64BECodeLength = 186; -static const JSC::Intrinsic s_jsBufferPrototypeWriteBigInt64BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteBigInt64BECode = - "(function (value, offset) {\n" \ - " \"use strict\";\n" \ - " (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setBigInt64(offset, value, false);\n" \ - " return offset + 8;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteBigUInt64LECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteBigUInt64LECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteBigUInt64LECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteBigUInt64LECodeLength = 186; -static const JSC::Intrinsic s_jsBufferPrototypeWriteBigUInt64LECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteBigUInt64LECode = - "(function (value, offset) {\n" \ - " \"use strict\";\n" \ - " (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setBigUint64(offset, value, true);\n" \ - " return offset + 8;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeWriteBigUInt64BECodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeWriteBigUInt64BECodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeWriteBigUInt64BECodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeWriteBigUInt64BECodeLength = 187; -static const JSC::Intrinsic s_jsBufferPrototypeWriteBigUInt64BECodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeWriteBigUInt64BECode = - "(function (value, offset) {\n" \ - " \"use strict\";\n" \ - " (this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setBigUint64(offset, value, false);\n" \ - " return offset + 8;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeUtf8WriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeUtf8WriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeUtf8WriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeUtf8WriteCodeLength = 105; -static const JSC::Intrinsic s_jsBufferPrototypeUtf8WriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeUtf8WriteCode = - "(function (text, offset, length) {\n" \ - " \"use strict\";\n" \ - " return this.write(text, offset, length, \"utf8\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeUcs2WriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeUcs2WriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeUcs2WriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeUcs2WriteCodeLength = 105; -static const JSC::Intrinsic s_jsBufferPrototypeUcs2WriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeUcs2WriteCode = - "(function (text, offset, length) {\n" \ - " \"use strict\";\n" \ - " return this.write(text, offset, length, \"ucs2\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeUtf16leWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeUtf16leWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeUtf16leWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeUtf16leWriteCodeLength = 108; -static const JSC::Intrinsic s_jsBufferPrototypeUtf16leWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeUtf16leWriteCode = - "(function (text, offset, length) {\n" \ - " \"use strict\";\n" \ - " return this.write(text, offset, length, \"utf16le\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeLatin1WriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeLatin1WriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeLatin1WriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeLatin1WriteCodeLength = 107; -static const JSC::Intrinsic s_jsBufferPrototypeLatin1WriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeLatin1WriteCode = - "(function (text, offset, length) {\n" \ - " \"use strict\";\n" \ - " return this.write(text, offset, length, \"latin1\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeAsciiWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeAsciiWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeAsciiWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeAsciiWriteCodeLength = 106; -static const JSC::Intrinsic s_jsBufferPrototypeAsciiWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeAsciiWriteCode = - "(function (text, offset, length) {\n" \ - " \"use strict\";\n" \ - " return this.write(text, offset, length, \"ascii\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeBase64WriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeBase64WriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeBase64WriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeBase64WriteCodeLength = 107; -static const JSC::Intrinsic s_jsBufferPrototypeBase64WriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeBase64WriteCode = - "(function (text, offset, length) {\n" \ - " \"use strict\";\n" \ - " return this.write(text, offset, length, \"base64\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeBase64urlWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeBase64urlWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeBase64urlWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeBase64urlWriteCodeLength = 110; -static const JSC::Intrinsic s_jsBufferPrototypeBase64urlWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeBase64urlWriteCode = - "(function (text, offset, length) {\n" \ - " \"use strict\";\n" \ - " return this.write(text, offset, length, \"base64url\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeHexWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeHexWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeHexWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeHexWriteCodeLength = 104; -static const JSC::Intrinsic s_jsBufferPrototypeHexWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeHexWriteCode = - "(function (text, offset, length) {\n" \ - " \"use strict\";\n" \ - " return this.write(text, offset, length, \"hex\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeUtf8SliceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeUtf8SliceCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeUtf8SliceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeUtf8SliceCodeLength = 96; -static const JSC::Intrinsic s_jsBufferPrototypeUtf8SliceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeUtf8SliceCode = - "(function (offset, length) {\n" \ - " \"use strict\";\n" \ - " return this.toString(offset, length, \"utf8\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeUcs2SliceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeUcs2SliceCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeUcs2SliceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeUcs2SliceCodeLength = 96; -static const JSC::Intrinsic s_jsBufferPrototypeUcs2SliceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeUcs2SliceCode = - "(function (offset, length) {\n" \ - " \"use strict\";\n" \ - " return this.toString(offset, length, \"ucs2\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeUtf16leSliceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeUtf16leSliceCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeUtf16leSliceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeUtf16leSliceCodeLength = 99; -static const JSC::Intrinsic s_jsBufferPrototypeUtf16leSliceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeUtf16leSliceCode = - "(function (offset, length) {\n" \ - " \"use strict\";\n" \ - " return this.toString(offset, length, \"utf16le\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeLatin1SliceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeLatin1SliceCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeLatin1SliceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeLatin1SliceCodeLength = 98; -static const JSC::Intrinsic s_jsBufferPrototypeLatin1SliceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeLatin1SliceCode = - "(function (offset, length) {\n" \ - " \"use strict\";\n" \ - " return this.toString(offset, length, \"latin1\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeAsciiSliceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeAsciiSliceCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeAsciiSliceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeAsciiSliceCodeLength = 97; -static const JSC::Intrinsic s_jsBufferPrototypeAsciiSliceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeAsciiSliceCode = - "(function (offset, length) {\n" \ - " \"use strict\";\n" \ - " return this.toString(offset, length, \"ascii\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeBase64SliceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeBase64SliceCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeBase64SliceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeBase64SliceCodeLength = 98; -static const JSC::Intrinsic s_jsBufferPrototypeBase64SliceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeBase64SliceCode = - "(function (offset, length) {\n" \ - " \"use strict\";\n" \ - " return this.toString(offset, length, \"base64\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeBase64urlSliceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeBase64urlSliceCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeBase64urlSliceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeBase64urlSliceCodeLength = 101; -static const JSC::Intrinsic s_jsBufferPrototypeBase64urlSliceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeBase64urlSliceCode = - "(function (offset, length) {\n" \ - " \"use strict\";\n" \ - " return this.toString(offset, length, \"base64url\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeHexSliceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeHexSliceCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeHexSliceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeHexSliceCodeLength = 95; -static const JSC::Intrinsic s_jsBufferPrototypeHexSliceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeHexSliceCode = - "(function (offset, length) {\n" \ - " \"use strict\";\n" \ - " return this.toString(offset, length, \"hex\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeToJSONCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeToJSONCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeToJSONCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeToJSONCodeLength = 118; -static const JSC::Intrinsic s_jsBufferPrototypeToJSONCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeToJSONCode = - "(function () {\n" \ - " \"use strict\";\n" \ - " const type = \"Buffer\";\n" \ - " const data = @Array.from(this);\n" \ - " return { type, data };\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeSliceCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeSliceCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeSliceCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeSliceCodeLength = 613; -static const JSC::Intrinsic s_jsBufferPrototypeSliceCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeSliceCode = - "(function (start, end) {\n" \ - " \"use strict\";\n" \ - " var { buffer, byteOffset, byteLength } = this;\n" \ - "\n" \ - " function adjustOffset(offset, length) {\n" \ - " //\n" \ - " //\n" \ - " offset = @trunc(offset);\n" \ - " if (offset === 0 || @isNaN(offset)) {\n" \ - " return 0;\n" \ - " } else if (offset < 0) {\n" \ - " offset += length;\n" \ - " return offset > 0 ? offset : 0;\n" \ - " } else {\n" \ - " return offset < length ? offset : length;\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " var start_ = adjustOffset(start, byteLength);\n" \ - " var end_ = end !== @undefined ? adjustOffset(end, byteLength) : byteLength;\n" \ - " return new Buffer(buffer, byteOffset + start_, end_ > start_ ? (end_ - start_) : 0);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeParentCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeParentCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeParentCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeParentCodeLength = 114; -static const JSC::Intrinsic s_jsBufferPrototypeParentCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeParentCode = - "(function () {\n" \ - " \"use strict\";\n" \ - " return @isObject(this) && this instanceof @Buffer ? this.buffer : @undefined;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_jsBufferPrototypeOffsetCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_jsBufferPrototypeOffsetCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_jsBufferPrototypeOffsetCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferPrototypeOffsetCodeLength = 118; -static const JSC::Intrinsic s_jsBufferPrototypeOffsetCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_jsBufferPrototypeOffsetCode = - "(function () {\n" \ - " \"use strict\";\n" \ - " return @isObject(this) && this instanceof @Buffer ? this.byteOffset : @undefined;\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().jsBufferPrototypeBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().jsBufferPrototypeBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.h b/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.h deleted file mode 100644 index 47e720468..000000000 --- a/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.h +++ /dev/null @@ -1,713 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* JSBufferPrototype */ -extern const char* const s_jsBufferPrototypeSetBigUint64Code; -extern const int s_jsBufferPrototypeSetBigUint64CodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeSetBigUint64CodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeSetBigUint64CodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeSetBigUint64CodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadInt8Code; -extern const int s_jsBufferPrototypeReadInt8CodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadInt8CodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadInt8CodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt8CodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadUInt8Code; -extern const int s_jsBufferPrototypeReadUInt8CodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadUInt8CodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadUInt8CodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt8CodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadInt16LECode; -extern const int s_jsBufferPrototypeReadInt16LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadInt16LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadInt16LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt16LECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadInt16BECode; -extern const int s_jsBufferPrototypeReadInt16BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadInt16BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadInt16BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt16BECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadUInt16LECode; -extern const int s_jsBufferPrototypeReadUInt16LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadUInt16LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadUInt16LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt16LECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadUInt16BECode; -extern const int s_jsBufferPrototypeReadUInt16BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadUInt16BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadUInt16BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt16BECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadInt32LECode; -extern const int s_jsBufferPrototypeReadInt32LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadInt32LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadInt32LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt32LECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadInt32BECode; -extern const int s_jsBufferPrototypeReadInt32BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadInt32BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadInt32BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadInt32BECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadUInt32LECode; -extern const int s_jsBufferPrototypeReadUInt32LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadUInt32LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadUInt32LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt32LECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadUInt32BECode; -extern const int s_jsBufferPrototypeReadUInt32BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadUInt32BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadUInt32BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadUInt32BECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadIntLECode; -extern const int s_jsBufferPrototypeReadIntLECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadIntLECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadIntLECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadIntLECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadIntBECode; -extern const int s_jsBufferPrototypeReadIntBECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadIntBECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadIntBECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadIntBECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadUIntLECode; -extern const int s_jsBufferPrototypeReadUIntLECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadUIntLECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadUIntLECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadUIntLECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeInspectCode; -extern const int s_jsBufferPrototypeInspectCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeInspectCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeInspectCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeInspectCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadUIntBECode; -extern const int s_jsBufferPrototypeReadUIntBECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadUIntBECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadUIntBECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadUIntBECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadFloatLECode; -extern const int s_jsBufferPrototypeReadFloatLECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadFloatLECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadFloatLECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadFloatLECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadFloatBECode; -extern const int s_jsBufferPrototypeReadFloatBECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadFloatBECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadFloatBECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadFloatBECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadDoubleLECode; -extern const int s_jsBufferPrototypeReadDoubleLECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadDoubleLECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadDoubleLECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadDoubleLECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadDoubleBECode; -extern const int s_jsBufferPrototypeReadDoubleBECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadDoubleBECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadDoubleBECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadDoubleBECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadBigInt64LECode; -extern const int s_jsBufferPrototypeReadBigInt64LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadBigInt64LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadBigInt64LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadBigInt64LECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadBigInt64BECode; -extern const int s_jsBufferPrototypeReadBigInt64BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadBigInt64BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadBigInt64BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadBigInt64BECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadBigUInt64LECode; -extern const int s_jsBufferPrototypeReadBigUInt64LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadBigUInt64LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadBigUInt64LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadBigUInt64LECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeReadBigUInt64BECode; -extern const int s_jsBufferPrototypeReadBigUInt64BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeReadBigUInt64BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeReadBigUInt64BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadBigUInt64BECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteInt8Code; -extern const int s_jsBufferPrototypeWriteInt8CodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteInt8CodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteInt8CodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt8CodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteUInt8Code; -extern const int s_jsBufferPrototypeWriteUInt8CodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt8CodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt8CodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt8CodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteInt16LECode; -extern const int s_jsBufferPrototypeWriteInt16LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteInt16LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteInt16LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt16LECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteInt16BECode; -extern const int s_jsBufferPrototypeWriteInt16BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteInt16BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteInt16BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt16BECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteUInt16LECode; -extern const int s_jsBufferPrototypeWriteUInt16LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt16LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt16LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt16LECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteUInt16BECode; -extern const int s_jsBufferPrototypeWriteUInt16BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt16BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt16BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt16BECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteInt32LECode; -extern const int s_jsBufferPrototypeWriteInt32LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteInt32LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteInt32LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt32LECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteInt32BECode; -extern const int s_jsBufferPrototypeWriteInt32BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteInt32BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteInt32BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteInt32BECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteUInt32LECode; -extern const int s_jsBufferPrototypeWriteUInt32LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt32LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt32LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt32LECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteUInt32BECode; -extern const int s_jsBufferPrototypeWriteUInt32BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteUInt32BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteUInt32BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUInt32BECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteIntLECode; -extern const int s_jsBufferPrototypeWriteIntLECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteIntLECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteIntLECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteIntLECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteIntBECode; -extern const int s_jsBufferPrototypeWriteIntBECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteIntBECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteIntBECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteIntBECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteUIntLECode; -extern const int s_jsBufferPrototypeWriteUIntLECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteUIntLECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteUIntLECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUIntLECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteUIntBECode; -extern const int s_jsBufferPrototypeWriteUIntBECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteUIntBECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteUIntBECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteUIntBECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteFloatLECode; -extern const int s_jsBufferPrototypeWriteFloatLECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteFloatLECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteFloatLECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteFloatLECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteFloatBECode; -extern const int s_jsBufferPrototypeWriteFloatBECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteFloatBECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteFloatBECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteFloatBECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteDoubleLECode; -extern const int s_jsBufferPrototypeWriteDoubleLECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteDoubleLECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteDoubleLECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteDoubleLECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteDoubleBECode; -extern const int s_jsBufferPrototypeWriteDoubleBECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteDoubleBECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteDoubleBECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteDoubleBECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteBigInt64LECode; -extern const int s_jsBufferPrototypeWriteBigInt64LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteBigInt64LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteBigInt64LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteBigInt64LECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteBigInt64BECode; -extern const int s_jsBufferPrototypeWriteBigInt64BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteBigInt64BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteBigInt64BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteBigInt64BECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteBigUInt64LECode; -extern const int s_jsBufferPrototypeWriteBigUInt64LECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteBigUInt64LECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteBigUInt64LECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteBigUInt64LECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeWriteBigUInt64BECode; -extern const int s_jsBufferPrototypeWriteBigUInt64BECodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeWriteBigUInt64BECodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeWriteBigUInt64BECodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeWriteBigUInt64BECodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeUtf8WriteCode; -extern const int s_jsBufferPrototypeUtf8WriteCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeUtf8WriteCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeUtf8WriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeUtf8WriteCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeUcs2WriteCode; -extern const int s_jsBufferPrototypeUcs2WriteCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeUcs2WriteCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeUcs2WriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeUcs2WriteCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeUtf16leWriteCode; -extern const int s_jsBufferPrototypeUtf16leWriteCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeUtf16leWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeUtf16leWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeUtf16leWriteCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeLatin1WriteCode; -extern const int s_jsBufferPrototypeLatin1WriteCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeLatin1WriteCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeLatin1WriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeLatin1WriteCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeAsciiWriteCode; -extern const int s_jsBufferPrototypeAsciiWriteCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeAsciiWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeAsciiWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeAsciiWriteCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeBase64WriteCode; -extern const int s_jsBufferPrototypeBase64WriteCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeBase64WriteCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeBase64WriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeBase64WriteCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeBase64urlWriteCode; -extern const int s_jsBufferPrototypeBase64urlWriteCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeBase64urlWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeBase64urlWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeBase64urlWriteCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeHexWriteCode; -extern const int s_jsBufferPrototypeHexWriteCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeHexWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeHexWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeHexWriteCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeUtf8SliceCode; -extern const int s_jsBufferPrototypeUtf8SliceCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeUtf8SliceCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeUtf8SliceCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeUtf8SliceCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeUcs2SliceCode; -extern const int s_jsBufferPrototypeUcs2SliceCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeUcs2SliceCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeUcs2SliceCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeUcs2SliceCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeUtf16leSliceCode; -extern const int s_jsBufferPrototypeUtf16leSliceCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeUtf16leSliceCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeUtf16leSliceCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeUtf16leSliceCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeLatin1SliceCode; -extern const int s_jsBufferPrototypeLatin1SliceCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeLatin1SliceCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeLatin1SliceCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeLatin1SliceCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeAsciiSliceCode; -extern const int s_jsBufferPrototypeAsciiSliceCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeAsciiSliceCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeAsciiSliceCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeAsciiSliceCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeBase64SliceCode; -extern const int s_jsBufferPrototypeBase64SliceCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeBase64SliceCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeBase64SliceCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeBase64SliceCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeBase64urlSliceCode; -extern const int s_jsBufferPrototypeBase64urlSliceCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeBase64urlSliceCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeBase64urlSliceCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeBase64urlSliceCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeHexSliceCode; -extern const int s_jsBufferPrototypeHexSliceCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeHexSliceCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeHexSliceCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeHexSliceCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeToJSONCode; -extern const int s_jsBufferPrototypeToJSONCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeToJSONCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeToJSONCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeToJSONCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeSliceCode; -extern const int s_jsBufferPrototypeSliceCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeSliceCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeSliceCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeSliceCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeParentCode; -extern const int s_jsBufferPrototypeParentCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeParentCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeParentCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeParentCodeImplementationVisibility; -extern const char* const s_jsBufferPrototypeOffsetCode; -extern const int s_jsBufferPrototypeOffsetCodeLength; -extern const JSC::ConstructAbility s_jsBufferPrototypeOffsetCodeConstructAbility; -extern const JSC::ConstructorKind s_jsBufferPrototypeOffsetCodeConstructorKind; -extern const JSC::ImplementationVisibility s_jsBufferPrototypeOffsetCodeImplementationVisibility; - -#define WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_DATA(macro) \ - macro(setBigUint64, jsBufferPrototypeSetBigUint64, 3) \ - macro(readInt8, jsBufferPrototypeReadInt8, 1) \ - macro(readUInt8, jsBufferPrototypeReadUInt8, 1) \ - macro(readInt16LE, jsBufferPrototypeReadInt16LE, 1) \ - macro(readInt16BE, jsBufferPrototypeReadInt16BE, 1) \ - macro(readUInt16LE, jsBufferPrototypeReadUInt16LE, 1) \ - macro(readUInt16BE, jsBufferPrototypeReadUInt16BE, 1) \ - macro(readInt32LE, jsBufferPrototypeReadInt32LE, 1) \ - macro(readInt32BE, jsBufferPrototypeReadInt32BE, 1) \ - macro(readUInt32LE, jsBufferPrototypeReadUInt32LE, 1) \ - macro(readUInt32BE, jsBufferPrototypeReadUInt32BE, 1) \ - macro(readIntLE, jsBufferPrototypeReadIntLE, 2) \ - macro(readIntBE, jsBufferPrototypeReadIntBE, 2) \ - macro(readUIntLE, jsBufferPrototypeReadUIntLE, 2) \ - macro(inspect, jsBufferPrototypeInspect, 2) \ - macro(readUIntBE, jsBufferPrototypeReadUIntBE, 2) \ - macro(readFloatLE, jsBufferPrototypeReadFloatLE, 1) \ - macro(readFloatBE, jsBufferPrototypeReadFloatBE, 1) \ - macro(readDoubleLE, jsBufferPrototypeReadDoubleLE, 1) \ - macro(readDoubleBE, jsBufferPrototypeReadDoubleBE, 1) \ - macro(readBigInt64LE, jsBufferPrototypeReadBigInt64LE, 1) \ - macro(readBigInt64BE, jsBufferPrototypeReadBigInt64BE, 1) \ - macro(readBigUInt64LE, jsBufferPrototypeReadBigUInt64LE, 1) \ - macro(readBigUInt64BE, jsBufferPrototypeReadBigUInt64BE, 1) \ - macro(writeInt8, jsBufferPrototypeWriteInt8, 2) \ - macro(writeUInt8, jsBufferPrototypeWriteUInt8, 2) \ - macro(writeInt16LE, jsBufferPrototypeWriteInt16LE, 2) \ - macro(writeInt16BE, jsBufferPrototypeWriteInt16BE, 2) \ - macro(writeUInt16LE, jsBufferPrototypeWriteUInt16LE, 2) \ - macro(writeUInt16BE, jsBufferPrototypeWriteUInt16BE, 2) \ - macro(writeInt32LE, jsBufferPrototypeWriteInt32LE, 2) \ - macro(writeInt32BE, jsBufferPrototypeWriteInt32BE, 2) \ - macro(writeUInt32LE, jsBufferPrototypeWriteUInt32LE, 2) \ - macro(writeUInt32BE, jsBufferPrototypeWriteUInt32BE, 2) \ - macro(writeIntLE, jsBufferPrototypeWriteIntLE, 3) \ - macro(writeIntBE, jsBufferPrototypeWriteIntBE, 3) \ - macro(writeUIntLE, jsBufferPrototypeWriteUIntLE, 3) \ - macro(writeUIntBE, jsBufferPrototypeWriteUIntBE, 3) \ - macro(writeFloatLE, jsBufferPrototypeWriteFloatLE, 2) \ - macro(writeFloatBE, jsBufferPrototypeWriteFloatBE, 2) \ - macro(writeDoubleLE, jsBufferPrototypeWriteDoubleLE, 2) \ - macro(writeDoubleBE, jsBufferPrototypeWriteDoubleBE, 2) \ - macro(writeBigInt64LE, jsBufferPrototypeWriteBigInt64LE, 2) \ - macro(writeBigInt64BE, jsBufferPrototypeWriteBigInt64BE, 2) \ - macro(writeBigUInt64LE, jsBufferPrototypeWriteBigUInt64LE, 2) \ - macro(writeBigUInt64BE, jsBufferPrototypeWriteBigUInt64BE, 2) \ - macro(utf8Write, jsBufferPrototypeUtf8Write, 3) \ - macro(ucs2Write, jsBufferPrototypeUcs2Write, 3) \ - macro(utf16leWrite, jsBufferPrototypeUtf16leWrite, 3) \ - macro(latin1Write, jsBufferPrototypeLatin1Write, 3) \ - macro(asciiWrite, jsBufferPrototypeAsciiWrite, 3) \ - macro(base64Write, jsBufferPrototypeBase64Write, 3) \ - macro(base64urlWrite, jsBufferPrototypeBase64urlWrite, 3) \ - macro(hexWrite, jsBufferPrototypeHexWrite, 3) \ - macro(utf8Slice, jsBufferPrototypeUtf8Slice, 2) \ - macro(ucs2Slice, jsBufferPrototypeUcs2Slice, 2) \ - macro(utf16leSlice, jsBufferPrototypeUtf16leSlice, 2) \ - macro(latin1Slice, jsBufferPrototypeLatin1Slice, 2) \ - macro(asciiSlice, jsBufferPrototypeAsciiSlice, 2) \ - macro(base64Slice, jsBufferPrototypeBase64Slice, 2) \ - macro(base64urlSlice, jsBufferPrototypeBase64urlSlice, 2) \ - macro(hexSlice, jsBufferPrototypeHexSlice, 2) \ - macro(toJSON, jsBufferPrototypeToJSON, 0) \ - macro(slice, jsBufferPrototypeSlice, 2) \ - macro(parent, jsBufferPrototypeParent, 0) \ - macro(offset, jsBufferPrototypeOffset, 0) \ - -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_SETBIGUINT64 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READINT8 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READUINT8 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READINT16LE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READINT16BE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READUINT16LE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READUINT16BE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READINT32LE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READINT32BE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READUINT32LE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READUINT32BE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READINTLE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READINTBE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READUINTLE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_INSPECT 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READUINTBE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READFLOATLE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READFLOATBE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READDOUBLELE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READDOUBLEBE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READBIGINT64LE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READBIGINT64BE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READBIGUINT64LE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READBIGUINT64BE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEINT8 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEUINT8 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEINT16LE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEINT16BE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEUINT16LE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEUINT16BE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEINT32LE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEINT32BE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEUINT32LE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEUINT32BE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEINTLE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEINTBE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEUINTLE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEUINTBE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEFLOATLE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEFLOATBE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEDOUBLELE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEDOUBLEBE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEBIGINT64LE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEBIGINT64BE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEBIGUINT64LE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_WRITEBIGUINT64BE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_UTF8WRITE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_UCS2WRITE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_UTF16LEWRITE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_LATIN1WRITE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_ASCIIWRITE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_BASE64WRITE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_BASE64URLWRITE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_HEXWRITE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_UTF8SLICE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_UCS2SLICE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_UTF16LESLICE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_LATIN1SLICE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_ASCIISLICE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_BASE64SLICE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_BASE64URLSLICE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_HEXSLICE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_TOJSON 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_SLICE 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_PARENT 1 -#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_OFFSET 1 - -#define WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_CODE(macro) \ - macro(jsBufferPrototypeSetBigUint64Code, setBigUint64, ASCIILiteral(), s_jsBufferPrototypeSetBigUint64CodeLength) \ - macro(jsBufferPrototypeReadInt8Code, readInt8, ASCIILiteral(), s_jsBufferPrototypeReadInt8CodeLength) \ - macro(jsBufferPrototypeReadUInt8Code, readUInt8, ASCIILiteral(), s_jsBufferPrototypeReadUInt8CodeLength) \ - macro(jsBufferPrototypeReadInt16LECode, readInt16LE, ASCIILiteral(), s_jsBufferPrototypeReadInt16LECodeLength) \ - macro(jsBufferPrototypeReadInt16BECode, readInt16BE, ASCIILiteral(), s_jsBufferPrototypeReadInt16BECodeLength) \ - macro(jsBufferPrototypeReadUInt16LECode, readUInt16LE, ASCIILiteral(), s_jsBufferPrototypeReadUInt16LECodeLength) \ - macro(jsBufferPrototypeReadUInt16BECode, readUInt16BE, ASCIILiteral(), s_jsBufferPrototypeReadUInt16BECodeLength) \ - macro(jsBufferPrototypeReadInt32LECode, readInt32LE, ASCIILiteral(), s_jsBufferPrototypeReadInt32LECodeLength) \ - macro(jsBufferPrototypeReadInt32BECode, readInt32BE, ASCIILiteral(), s_jsBufferPrototypeReadInt32BECodeLength) \ - macro(jsBufferPrototypeReadUInt32LECode, readUInt32LE, ASCIILiteral(), s_jsBufferPrototypeReadUInt32LECodeLength) \ - macro(jsBufferPrototypeReadUInt32BECode, readUInt32BE, ASCIILiteral(), s_jsBufferPrototypeReadUInt32BECodeLength) \ - macro(jsBufferPrototypeReadIntLECode, readIntLE, ASCIILiteral(), s_jsBufferPrototypeReadIntLECodeLength) \ - macro(jsBufferPrototypeReadIntBECode, readIntBE, ASCIILiteral(), s_jsBufferPrototypeReadIntBECodeLength) \ - macro(jsBufferPrototypeReadUIntLECode, readUIntLE, ASCIILiteral(), s_jsBufferPrototypeReadUIntLECodeLength) \ - macro(jsBufferPrototypeInspectCode, inspect, ASCIILiteral(), s_jsBufferPrototypeInspectCodeLength) \ - macro(jsBufferPrototypeReadUIntBECode, readUIntBE, ASCIILiteral(), s_jsBufferPrototypeReadUIntBECodeLength) \ - macro(jsBufferPrototypeReadFloatLECode, readFloatLE, ASCIILiteral(), s_jsBufferPrototypeReadFloatLECodeLength) \ - macro(jsBufferPrototypeReadFloatBECode, readFloatBE, ASCIILiteral(), s_jsBufferPrototypeReadFloatBECodeLength) \ - macro(jsBufferPrototypeReadDoubleLECode, readDoubleLE, ASCIILiteral(), s_jsBufferPrototypeReadDoubleLECodeLength) \ - macro(jsBufferPrototypeReadDoubleBECode, readDoubleBE, ASCIILiteral(), s_jsBufferPrototypeReadDoubleBECodeLength) \ - macro(jsBufferPrototypeReadBigInt64LECode, readBigInt64LE, ASCIILiteral(), s_jsBufferPrototypeReadBigInt64LECodeLength) \ - macro(jsBufferPrototypeReadBigInt64BECode, readBigInt64BE, ASCIILiteral(), s_jsBufferPrototypeReadBigInt64BECodeLength) \ - macro(jsBufferPrototypeReadBigUInt64LECode, readBigUInt64LE, ASCIILiteral(), s_jsBufferPrototypeReadBigUInt64LECodeLength) \ - macro(jsBufferPrototypeReadBigUInt64BECode, readBigUInt64BE, ASCIILiteral(), s_jsBufferPrototypeReadBigUInt64BECodeLength) \ - macro(jsBufferPrototypeWriteInt8Code, writeInt8, ASCIILiteral(), s_jsBufferPrototypeWriteInt8CodeLength) \ - macro(jsBufferPrototypeWriteUInt8Code, writeUInt8, ASCIILiteral(), s_jsBufferPrototypeWriteUInt8CodeLength) \ - macro(jsBufferPrototypeWriteInt16LECode, writeInt16LE, ASCIILiteral(), s_jsBufferPrototypeWriteInt16LECodeLength) \ - macro(jsBufferPrototypeWriteInt16BECode, writeInt16BE, ASCIILiteral(), s_jsBufferPrototypeWriteInt16BECodeLength) \ - macro(jsBufferPrototypeWriteUInt16LECode, writeUInt16LE, ASCIILiteral(), s_jsBufferPrototypeWriteUInt16LECodeLength) \ - macro(jsBufferPrototypeWriteUInt16BECode, writeUInt16BE, ASCIILiteral(), s_jsBufferPrototypeWriteUInt16BECodeLength) \ - macro(jsBufferPrototypeWriteInt32LECode, writeInt32LE, ASCIILiteral(), s_jsBufferPrototypeWriteInt32LECodeLength) \ - macro(jsBufferPrototypeWriteInt32BECode, writeInt32BE, ASCIILiteral(), s_jsBufferPrototypeWriteInt32BECodeLength) \ - macro(jsBufferPrototypeWriteUInt32LECode, writeUInt32LE, ASCIILiteral(), s_jsBufferPrototypeWriteUInt32LECodeLength) \ - macro(jsBufferPrototypeWriteUInt32BECode, writeUInt32BE, ASCIILiteral(), s_jsBufferPrototypeWriteUInt32BECodeLength) \ - macro(jsBufferPrototypeWriteIntLECode, writeIntLE, ASCIILiteral(), s_jsBufferPrototypeWriteIntLECodeLength) \ - macro(jsBufferPrototypeWriteIntBECode, writeIntBE, ASCIILiteral(), s_jsBufferPrototypeWriteIntBECodeLength) \ - macro(jsBufferPrototypeWriteUIntLECode, writeUIntLE, ASCIILiteral(), s_jsBufferPrototypeWriteUIntLECodeLength) \ - macro(jsBufferPrototypeWriteUIntBECode, writeUIntBE, ASCIILiteral(), s_jsBufferPrototypeWriteUIntBECodeLength) \ - macro(jsBufferPrototypeWriteFloatLECode, writeFloatLE, ASCIILiteral(), s_jsBufferPrototypeWriteFloatLECodeLength) \ - macro(jsBufferPrototypeWriteFloatBECode, writeFloatBE, ASCIILiteral(), s_jsBufferPrototypeWriteFloatBECodeLength) \ - macro(jsBufferPrototypeWriteDoubleLECode, writeDoubleLE, ASCIILiteral(), s_jsBufferPrototypeWriteDoubleLECodeLength) \ - macro(jsBufferPrototypeWriteDoubleBECode, writeDoubleBE, ASCIILiteral(), s_jsBufferPrototypeWriteDoubleBECodeLength) \ - macro(jsBufferPrototypeWriteBigInt64LECode, writeBigInt64LE, ASCIILiteral(), s_jsBufferPrototypeWriteBigInt64LECodeLength) \ - macro(jsBufferPrototypeWriteBigInt64BECode, writeBigInt64BE, ASCIILiteral(), s_jsBufferPrototypeWriteBigInt64BECodeLength) \ - macro(jsBufferPrototypeWriteBigUInt64LECode, writeBigUInt64LE, ASCIILiteral(), s_jsBufferPrototypeWriteBigUInt64LECodeLength) \ - macro(jsBufferPrototypeWriteBigUInt64BECode, writeBigUInt64BE, ASCIILiteral(), s_jsBufferPrototypeWriteBigUInt64BECodeLength) \ - macro(jsBufferPrototypeUtf8WriteCode, utf8Write, ASCIILiteral(), s_jsBufferPrototypeUtf8WriteCodeLength) \ - macro(jsBufferPrototypeUcs2WriteCode, ucs2Write, ASCIILiteral(), s_jsBufferPrototypeUcs2WriteCodeLength) \ - macro(jsBufferPrototypeUtf16leWriteCode, utf16leWrite, ASCIILiteral(), s_jsBufferPrototypeUtf16leWriteCodeLength) \ - macro(jsBufferPrototypeLatin1WriteCode, latin1Write, ASCIILiteral(), s_jsBufferPrototypeLatin1WriteCodeLength) \ - macro(jsBufferPrototypeAsciiWriteCode, asciiWrite, ASCIILiteral(), s_jsBufferPrototypeAsciiWriteCodeLength) \ - macro(jsBufferPrototypeBase64WriteCode, base64Write, ASCIILiteral(), s_jsBufferPrototypeBase64WriteCodeLength) \ - macro(jsBufferPrototypeBase64urlWriteCode, base64urlWrite, ASCIILiteral(), s_jsBufferPrototypeBase64urlWriteCodeLength) \ - macro(jsBufferPrototypeHexWriteCode, hexWrite, ASCIILiteral(), s_jsBufferPrototypeHexWriteCodeLength) \ - macro(jsBufferPrototypeUtf8SliceCode, utf8Slice, ASCIILiteral(), s_jsBufferPrototypeUtf8SliceCodeLength) \ - macro(jsBufferPrototypeUcs2SliceCode, ucs2Slice, ASCIILiteral(), s_jsBufferPrototypeUcs2SliceCodeLength) \ - macro(jsBufferPrototypeUtf16leSliceCode, utf16leSlice, ASCIILiteral(), s_jsBufferPrototypeUtf16leSliceCodeLength) \ - macro(jsBufferPrototypeLatin1SliceCode, latin1Slice, ASCIILiteral(), s_jsBufferPrototypeLatin1SliceCodeLength) \ - macro(jsBufferPrototypeAsciiSliceCode, asciiSlice, ASCIILiteral(), s_jsBufferPrototypeAsciiSliceCodeLength) \ - macro(jsBufferPrototypeBase64SliceCode, base64Slice, ASCIILiteral(), s_jsBufferPrototypeBase64SliceCodeLength) \ - macro(jsBufferPrototypeBase64urlSliceCode, base64urlSlice, ASCIILiteral(), s_jsBufferPrototypeBase64urlSliceCodeLength) \ - macro(jsBufferPrototypeHexSliceCode, hexSlice, ASCIILiteral(), s_jsBufferPrototypeHexSliceCodeLength) \ - macro(jsBufferPrototypeToJSONCode, toJSON, ASCIILiteral(), s_jsBufferPrototypeToJSONCodeLength) \ - macro(jsBufferPrototypeSliceCode, slice, ASCIILiteral(), s_jsBufferPrototypeSliceCodeLength) \ - macro(jsBufferPrototypeParentCode, parent, "get parent"_s, s_jsBufferPrototypeParentCodeLength) \ - macro(jsBufferPrototypeOffsetCode, offset, "get offset"_s, s_jsBufferPrototypeOffsetCodeLength) \ - -#define WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_FUNCTION_NAME(macro) \ - macro(asciiSlice) \ - macro(asciiWrite) \ - macro(base64Slice) \ - macro(base64Write) \ - macro(base64urlSlice) \ - macro(base64urlWrite) \ - macro(hexSlice) \ - macro(hexWrite) \ - macro(inspect) \ - macro(latin1Slice) \ - macro(latin1Write) \ - macro(offset) \ - macro(parent) \ - macro(readBigInt64BE) \ - macro(readBigInt64LE) \ - macro(readBigUInt64BE) \ - macro(readBigUInt64LE) \ - macro(readDoubleBE) \ - macro(readDoubleLE) \ - macro(readFloatBE) \ - macro(readFloatLE) \ - macro(readInt16BE) \ - macro(readInt16LE) \ - macro(readInt32BE) \ - macro(readInt32LE) \ - macro(readInt8) \ - macro(readIntBE) \ - macro(readIntLE) \ - macro(readUInt16BE) \ - macro(readUInt16LE) \ - macro(readUInt32BE) \ - macro(readUInt32LE) \ - macro(readUInt8) \ - macro(readUIntBE) \ - macro(readUIntLE) \ - macro(setBigUint64) \ - macro(slice) \ - macro(toJSON) \ - macro(ucs2Slice) \ - macro(ucs2Write) \ - macro(utf16leSlice) \ - macro(utf16leWrite) \ - macro(utf8Slice) \ - macro(utf8Write) \ - macro(writeBigInt64BE) \ - macro(writeBigInt64LE) \ - macro(writeBigUInt64BE) \ - macro(writeBigUInt64LE) \ - macro(writeDoubleBE) \ - macro(writeDoubleLE) \ - macro(writeFloatBE) \ - macro(writeFloatLE) \ - macro(writeInt16BE) \ - macro(writeInt16LE) \ - macro(writeInt32BE) \ - macro(writeInt32LE) \ - macro(writeInt8) \ - macro(writeIntBE) \ - macro(writeIntLE) \ - macro(writeUInt16BE) \ - macro(writeUInt16LE) \ - macro(writeUInt32BE) \ - macro(writeUInt32LE) \ - macro(writeUInt8) \ - macro(writeUIntBE) \ - macro(writeUIntLE) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class JSBufferPrototypeBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit JSBufferPrototypeBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* JSBufferPrototypeBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void JSBufferPrototypeBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.cpp b/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.cpp deleted file mode 100644 index ecd86f811..000000000 --- a/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.cpp +++ /dev/null @@ -1,737 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "ProcessObjectInternalsBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_processObjectInternalsBindingCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_processObjectInternalsBindingCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_processObjectInternalsBindingCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_processObjectInternalsBindingCodeLength = 709; -static const JSC::Intrinsic s_processObjectInternalsBindingCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_processObjectInternalsBindingCode = - "(function (bindingName) {\n" \ - " \"use strict\";\n" \ - " bindingName !== \"constants\" &&\n" \ - " @throwTypeError(\n" \ - " 'process.binding() is not supported in Bun. If that breaks something, please file an issue and include a reproducible code sample.'\n" \ - " );\n" \ - "\n" \ - " var cache = globalThis.Symbol.for(\"process.bindings.constants\");\n" \ - " var constants = globalThis[cache];\n" \ - " if (!constants) {\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " const {constants: fs} = globalThis[globalThis.Symbol.for(\"Bun.lazy\")](\n" \ - " \"createImportMeta\",\n" \ - " \"node:process\"\n" \ - " ).require(\n" \ - " \"node:fs\"\n" \ - " )\n" \ - " constants = {\n" \ - " fs,\n" \ - " zlib: {},\n" \ - " crypto: {},\n" \ - " os: @Bun._Os().constants,\n" \ - " };\n" \ - " globalThis[cache] = constants;\n" \ - " }\n" \ - " return constants;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_processObjectInternalsGetStdioWriteStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_processObjectInternalsGetStdioWriteStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_processObjectInternalsGetStdioWriteStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_processObjectInternalsGetStdioWriteStreamCodeLength = 10295; -static const JSC::Intrinsic s_processObjectInternalsGetStdioWriteStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_processObjectInternalsGetStdioWriteStreamCode = - "(function (fd_, rawRequire) {\n" \ - " var module = { path: \"node:process\", require: rawRequire };\n" \ - " var require = path => module.require(path);\n" \ - "\n" \ - " function createStdioWriteStream(fd_) {\n" \ - " var { Duplex, eos, destroy } = require(\"node:stream\");\n" \ - " var StdioWriteStream = class StdioWriteStream extends Duplex {\n" \ - " #writeStream;\n" \ - " #readStream;\n" \ - "\n" \ - " #readable = true;\n" \ - " #writable = true;\n" \ - " #fdPath;\n" \ - "\n" \ - " #onClose;\n" \ - " #onDrain;\n" \ - " #onFinish;\n" \ - " #onReadable;\n" \ - " #isTTY;\n" \ - "\n" \ - " get isTTY() {\n" \ - " return (this.#isTTY ??= require(\"node:tty\").isatty(fd_));\n" \ - " }\n" \ - "\n" \ - " get fd() {\n" \ - " return fd_;\n" \ - " }\n" \ - "\n" \ - " constructor(fd) {\n" \ - " super({ readable: true, writable: true });\n" \ - " this.#fdPath = `/dev/fd/${fd}`;\n" \ - " }\n" \ - "\n" \ - " #onFinished(err) {\n" \ - " const cb = this.#onClose;\n" \ - " this.#onClose = null;\n" \ - "\n" \ - " if (cb) {\n" \ - " cb(err);\n" \ - " } else if (err) {\n" \ - " this.destroy(err);\n" \ - " } else if (!this.#readable && !this.#writable) {\n" \ - " this.destroy();\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " _destroy(err, callback) {\n" \ - " if (!err && this.#onClose !== null) {\n" \ - " var AbortError = class AbortError extends Error {\n" \ - " constructor(message = \"The operation was aborted\", options = void 0) {\n" \ - " if (options !== void 0 && typeof options !== \"object\") {\n" \ - " throw new Error(`Invalid AbortError options:\\n" \ - "\\n" \ - "${JSON.stringify(options, null, 2)}`);\n" \ - " }\n" \ - " super(message, options);\n" \ - " this.code = \"ABORT_ERR\";\n" \ - " this.name = \"AbortError\";\n" \ - " }\n" \ - " };\n" \ - " err = new AbortError();\n" \ - " }\n" \ - "\n" \ - " this.#onDrain = null;\n" \ - " this.#onFinish = null;\n" \ - " if (this.#onClose === null) {\n" \ - " callback(err);\n" \ - " } else {\n" \ - " this.#onClose = callback;\n" \ - " if (this.#writeStream) destroy(this.#writeStream, err);\n" \ - " if (this.#readStream) destroy(this.#readStream, err);\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " _write(chunk, encoding, callback) {\n" \ - " if (!this.#writeStream) {\n" \ - " var { createWriteStream } = require(\"node:fs\");\n" \ - " var stream = (this.#writeStream = createWriteStream(this.#fdPath));\n" \ - "\n" \ - " stream.on(\"finish\", () => {\n" \ - " if (this.#onFinish) {\n" \ - " const cb = this.#onFinish;\n" \ - " this.#onFinish = null;\n" \ - " cb();\n" \ - " }\n" \ - " });\n" \ - "\n" \ - " stream.on(\"drain\", () => {\n" \ - " if (this.#onDrain) {\n" \ - " const cb = this.#onDrain;\n" \ - " this.#onDrain = null;\n" \ - " cb();\n" \ - " }\n" \ - " });\n" \ - "\n" \ - " eos(stream, err => {\n" \ - " this.#writable = false;\n" \ - " if (err) {\n" \ - " destroy(stream, err);\n" \ - " }\n" \ - " this.#onFinished(err);\n" \ - " });\n" \ - " }\n" \ - " if (stream.write(chunk, encoding)) {\n" \ - " callback();\n" \ - " } else {\n" \ - " this.#onDrain = callback;\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " _final(callback) {\n" \ - " this.#writeStream && this.#writeStream.end();\n" \ - " this.#onFinish = callback;\n" \ - " }\n" \ - "\n" \ - " #loadReadStream() {\n" \ - " var { createReadStream } = require(\"node:fs\");\n" \ - "\n" \ - " var readStream = (this.#readStream = createReadStream(this.#fdPath));\n" \ - "\n" \ - " readStream.on(\"readable\", () => {\n" \ - " if (this.#onReadable) {\n" \ - " const cb = this.#onReadable;\n" \ - " this.#onReadable = null;\n" \ - " cb();\n" \ - " } else {\n" \ - " this.read();\n" \ - " }\n" \ - " });\n" \ - "\n" \ - " readStream.on(\"end\", () => {\n" \ - " this.push(null);\n" \ - " });\n" \ - "\n" \ - " eos(readStream, err => {\n" \ - " this.#readable = false;\n" \ - " if (err) {\n" \ - " destroy(readStream, err);\n" \ - " }\n" \ - " this.#onFinished(err);\n" \ - " });\n" \ - " return readStream;\n" \ - " }\n" \ - "\n" \ - " _read() {\n" \ - " var stream = this.#readStream;\n" \ - " if (!stream) {\n" \ - " stream = this.#loadReadStream();\n" \ - " }\n" \ - "\n" \ - " while (true) {\n" \ - " const buf = stream.read();\n" \ - " if (buf === null || !this.push(buf)) {\n" \ - " return;\n" \ - " }\n" \ - " }\n" \ - " }\n" \ - " };\n" \ - " return new StdioWriteStream(fd_);\n" \ - " }\n" \ - "\n" \ - " var { EventEmitter } = require(\"node:events\");\n" \ - "\n" \ - " function isFastEncoding(encoding) {\n" \ - " if (!encoding) return true;\n" \ - "\n" \ - " var normalied = encoding.toLowerCase();\n" \ - " return normalied === \"utf8\" || normalied === \"utf-8\" || normalied === \"buffer\" || normalied === \"binary\";\n" \ - " }\n" \ - "\n" \ - " var readline;\n" \ - "\n" \ - " var FastStdioWriteStream = class StdioWriteStream extends EventEmitter {\n" \ - " #fd;\n" \ - " #innerStream;\n" \ - " #writer;\n" \ - " #isTTY;\n" \ - "\n" \ - " bytesWritten = 0;\n" \ - "\n" \ - " setDefaultEncoding(encoding) {\n" \ - " if (this.#innerStream || !isFastEncoding(encoding)) {\n" \ - " this.#ensureInnerStream();\n" \ - " return this.#innerStream.setDefaultEncoding(encoding);\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " #createWriter() {\n" \ - " switch (this.#fd) {\n" \ - " case 1: {\n" \ - " var writer = Bun.stdout.writer({ highWaterMark: 0 });\n" \ - " writer.unref();\n" \ - " return writer;\n" \ - " }\n" \ - "\n" \ - " case 2: {\n" \ - " var writer = Bun.stderr.writer({ highWaterMark: 0 });\n" \ - " writer.unref();\n" \ - " return writer;\n" \ - " }\n" \ - " default: {\n" \ - " throw new Error(\"Unsupported writer\");\n" \ - " }\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " #getWriter() {\n" \ - " return (this.#writer ??= this.#createWriter());\n" \ - " }\n" \ - "\n" \ - " constructor(fd_) {\n" \ - " super();\n" \ - " this.#fd = fd_;\n" \ - " }\n" \ - "\n" \ - " get fd() {\n" \ - " return this.#fd;\n" \ - " }\n" \ - "\n" \ - " get isTTY() {\n" \ - " return (this.#isTTY ??= require(\"node:tty\").isatty(this.#fd));\n" \ - " }\n" \ - "\n" \ - " cursorTo(x, y, callback) {\n" \ - " return (readline ??= require(\"readline\")).cursorTo(this, x, y, callback);\n" \ - " }\n" \ - "\n" \ - " moveCursor(dx, dy, callback) {\n" \ - " return (readline ??= require(\"readline\")).moveCursor(this, dx, dy, callback);\n" \ - " }\n" \ - "\n" \ - " clearLine(dir, callback) {\n" \ - " return (readline ??= require(\"readline\")).clearLine(this, dir, callback);\n" \ - " }\n" \ - "\n" \ - " clearScreenDown(callback) {\n" \ - " return (readline ??= require(\"readline\")).clearScreenDown(this, callback);\n" \ - " }\n" \ - "\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - "\n" \ - " ref() {\n" \ - " this.#getWriter().ref();\n" \ - " }\n" \ - "\n" \ - " unref() {\n" \ - " this.#getWriter().unref();\n" \ - " }\n" \ - "\n" \ - " on(event, listener) {\n" \ - " if (event === \"close\" || event === \"finish\") {\n" \ - " this.#ensureInnerStream();\n" \ - " return this.#innerStream.on(event, listener);\n" \ - " }\n" \ - "\n" \ - " if (event === \"drain\") {\n" \ - " return super.on(\"drain\", listener);\n" \ - " }\n" \ - "\n" \ - " if (event === \"error\") {\n" \ - " return super.on(\"error\", listener);\n" \ - " }\n" \ - "\n" \ - " return super.on(event, listener);\n" \ - " }\n" \ - "\n" \ - " get _writableState() {\n" \ - " this.#ensureInnerStream();\n" \ - " return this.#innerStream._writableState;\n" \ - " }\n" \ - "\n" \ - " get _readableState() {\n" \ - " this.#ensureInnerStream();\n" \ - " return this.#innerStream._readableState;\n" \ - " }\n" \ - "\n" \ - " pipe(destination) {\n" \ - " this.#ensureInnerStream();\n" \ - " return this.#innerStream.pipe(destination);\n" \ - " }\n" \ - "\n" \ - " unpipe(destination) {\n" \ - " this.#ensureInnerStream();\n" \ - " return this.#innerStream.unpipe(destination);\n" \ - " }\n" \ - "\n" \ - " #ensureInnerStream() {\n" \ - " if (this.#innerStream) return;\n" \ - " this.#innerStream = createStdioWriteStream(this.#fd);\n" \ - " const events = this.eventNames();\n" \ - " for (const event of events) {\n" \ - " this.#innerStream.on(event, (...args) => {\n" \ - " this.emit(event, ...args);\n" \ - " });\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " #write1(chunk) {\n" \ - " var writer = this.#getWriter();\n" \ - " const writeResult = writer.write(chunk);\n" \ - " this.bytesWritten += writeResult;\n" \ - " const flushResult = writer.flush(false);\n" \ - " return !!(writeResult || flushResult);\n" \ - " }\n" \ - "\n" \ - " #writeWithEncoding(chunk, encoding) {\n" \ - " if (!isFastEncoding(encoding)) {\n" \ - " this.#ensureInnerStream();\n" \ - " return this.#innerStream.write(chunk, encoding);\n" \ - " }\n" \ - "\n" \ - " return this.#write1(chunk);\n" \ - " }\n" \ - "\n" \ - " #performCallback(cb, err) {\n" \ - " if (err) {\n" \ - " this.emit(\"error\", err);\n" \ - " }\n" \ - "\n" \ - " try {\n" \ - " cb(err ? err : null);\n" \ - " } catch (err2) {\n" \ - " this.emit(\"error\", err2);\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " #writeWithCallbackAndEncoding(chunk, encoding, callback) {\n" \ - " if (!isFastEncoding(encoding)) {\n" \ - " this.#ensureInnerStream();\n" \ - " return this.#innerStream.write(chunk, encoding, callback);\n" \ - " }\n" \ - "\n" \ - " var writer = this.#getWriter();\n" \ - " const writeResult = writer.write(chunk);\n" \ - " const flushResult = writer.flush(true);\n" \ - " if (flushResult?.then) {\n" \ - " flushResult.then(\n" \ - " () => {\n" \ - " this.#performCallback(callback);\n" \ - " this.emit(\"drain\");\n" \ - " },\n" \ - " err => this.#performCallback(callback, err),\n" \ - " );\n" \ - " return false;\n" \ - " }\n" \ - "\n" \ - " queueMicrotask(() => {\n" \ - " this.#performCallback(callback);\n" \ - " });\n" \ - "\n" \ - " return !!(writeResult || flushResult);\n" \ - " }\n" \ - "\n" \ - " write(chunk, encoding, callback) {\n" \ - " const result = this._write(chunk, encoding, callback);\n" \ - "\n" \ - " if (result) {\n" \ - " this.emit(\"drain\");\n" \ - " }\n" \ - "\n" \ - " return result;\n" \ - " }\n" \ - "\n" \ - " get hasColors() {\n" \ - " return Bun.tty[this.#fd].hasColors;\n" \ - " }\n" \ - "\n" \ - " _write(chunk, encoding, callback) {\n" \ - " var inner = this.#innerStream;\n" \ - " if (inner) {\n" \ - " return inner.write(chunk, encoding, callback);\n" \ - " }\n" \ - "\n" \ - " switch (arguments.length) {\n" \ - " case 0: {\n" \ - " var error = new Error(\"Invalid arguments\");\n" \ - " error.code = \"ERR_INVALID_ARG_TYPE\";\n" \ - " throw error;\n" \ - " }\n" \ - " case 1: {\n" \ - " return this.#write1(chunk);\n" \ - " }\n" \ - " case 2: {\n" \ - " if (typeof encoding === \"function\") {\n" \ - " return this.#writeWithCallbackAndEncoding(chunk, \"\", encoding);\n" \ - " } else if (typeof encoding === \"string\") {\n" \ - " return this.#writeWithEncoding(chunk, encoding);\n" \ - " }\n" \ - " }\n" \ - " default: {\n" \ - " if (\n" \ - " (typeof encoding !== \"undefined\" && typeof encoding !== \"string\") ||\n" \ - " (typeof callback !== \"undefined\" && typeof callback !== \"function\")\n" \ - " ) {\n" \ - " var error = new Error(\"Invalid arguments\");\n" \ - " error.code = \"ERR_INVALID_ARG_TYPE\";\n" \ - " throw error;\n" \ - " }\n" \ - "\n" \ - " if (typeof callback === \"undefined\") {\n" \ - " return this.#writeWithEncoding(chunk, encoding);\n" \ - " }\n" \ - "\n" \ - " return this.#writeWithCallbackAndEncoding(chunk, encoding, callback);\n" \ - " }\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " destroy() {\n" \ - " return this;\n" \ - " }\n" \ - "\n" \ - " end() {\n" \ - " return this;\n" \ - " }\n" \ - " };\n" \ - "\n" \ - " return new FastStdioWriteStream(fd_);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_processObjectInternalsGetStdinStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_processObjectInternalsGetStdinStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_processObjectInternalsGetStdinStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_processObjectInternalsGetStdinStreamCodeLength = 4305; -static const JSC::Intrinsic s_processObjectInternalsGetStdinStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_processObjectInternalsGetStdinStreamCode = - "(function (fd_, rawRequire, Bun) {\n" \ - " var module = { path: \"node:process\", require: rawRequire };\n" \ - " var require = path => module.require(path);\n" \ - "\n" \ - " var { Duplex, eos, destroy } = require(\"node:stream\");\n" \ - "\n" \ - " var StdinStream = class StdinStream extends Duplex {\n" \ - " #reader;\n" \ - " //\n" \ - "\n" \ - " #readRef;\n" \ - " #writeStream;\n" \ - "\n" \ - " #readable = true;\n" \ - " #unrefOnRead = false;\n" \ - " #writable = true;\n" \ - "\n" \ - " #onFinish;\n" \ - " #onClose;\n" \ - " #onDrain;\n" \ - "\n" \ - " get isTTY() {\n" \ - " return require(\"tty\").isatty(fd_);\n" \ - " }\n" \ - "\n" \ - " get fd() {\n" \ - " return fd_;\n" \ - " }\n" \ - "\n" \ - " constructor() {\n" \ - " super({ readable: true, writable: true });\n" \ - " }\n" \ - "\n" \ - " #onFinished(err) {\n" \ - " const cb = this.#onClose;\n" \ - " this.#onClose = null;\n" \ - "\n" \ - " if (cb) {\n" \ - " cb(err);\n" \ - " } else if (err) {\n" \ - " this.destroy(err);\n" \ - " } else if (!this.#readable && !this.#writable) {\n" \ - " this.destroy();\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " _destroy(err, callback) {\n" \ - " if (!err && this.#onClose !== null) {\n" \ - " var AbortError = class AbortError extends Error {\n" \ - " constructor(message = \"The operation was aborted\", options = void 0) {\n" \ - " if (options !== void 0 && typeof options !== \"object\") {\n" \ - " throw new Error(`Invalid AbortError options:\\n" \ - "\\n" \ - "${JSON.stringify(options, null, 2)}`);\n" \ - " }\n" \ - " super(message, options);\n" \ - " this.code = \"ABORT_ERR\";\n" \ - " this.name = \"AbortError\";\n" \ - " }\n" \ - " };\n" \ - " err = new AbortError();\n" \ - " }\n" \ - "\n" \ - " if (this.#onClose === null) {\n" \ - " callback(err);\n" \ - " } else {\n" \ - " this.#onClose = callback;\n" \ - " if (this.#writeStream) destroy(this.#writeStream, err);\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " setRawMode(mode) {}\n" \ - " on(name, callback) {\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " if (name === \"readable\") {\n" \ - " this.ref();\n" \ - " this.#unrefOnRead = true;\n" \ - " }\n" \ - " return super.on(name, callback);\n" \ - " }\n" \ - "\n" \ - " pause() {\n" \ - " this.unref();\n" \ - " return super.pause();\n" \ - " }\n" \ - "\n" \ - " resume() {\n" \ - " this.ref();\n" \ - " return super.resume();\n" \ - " }\n" \ - "\n" \ - " ref() {\n" \ - " this.#reader ??= Bun.stdin.stream().getReader();\n" \ - " this.#readRef ??= setInterval(() => {}, 1 << 30);\n" \ - " }\n" \ - "\n" \ - " unref() {\n" \ - " if (this.#readRef) {\n" \ - " clearInterval(this.#readRef);\n" \ - " this.#readRef = null;\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " async #readInternal() {\n" \ - " try {\n" \ - " var done, value;\n" \ - " const read = this.#reader.readMany();\n" \ - "\n" \ - " //\n" \ - " if (!read?.then) {\n" \ - " ({ done, value } = read);\n" \ - " } else {\n" \ - " ({ done, value } = await read);\n" \ - " }\n" \ - "\n" \ - " if (!done) {\n" \ - " this.push(value[0]);\n" \ - "\n" \ - " //\n" \ - " const length = value.length;\n" \ - " for (let i = 1; i < length; i++) {\n" \ - " this.push(value[i]);\n" \ - " }\n" \ - " } else {\n" \ - " this.push(null);\n" \ - " this.pause();\n" \ - " this.#readable = false;\n" \ - " this.#onFinished();\n" \ - " }\n" \ - " } catch (err) {\n" \ - " this.#readable = false;\n" \ - " this.#onFinished(err);\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " _read(size) {\n" \ - " if (this.#unrefOnRead) {\n" \ - " this.unref();\n" \ - " this.#unrefOnRead = false;\n" \ - " }\n" \ - " this.#readInternal();\n" \ - " }\n" \ - "\n" \ - " #constructWriteStream() {\n" \ - " var { createWriteStream } = require(\"node:fs\");\n" \ - " var writeStream = (this.#writeStream = createWriteStream(\"/dev/fd/0\"));\n" \ - "\n" \ - " writeStream.on(\"finish\", () => {\n" \ - " if (this.#onFinish) {\n" \ - " const cb = this.#onFinish;\n" \ - " this.#onFinish = null;\n" \ - " cb();\n" \ - " }\n" \ - " });\n" \ - "\n" \ - " writeStream.on(\"drain\", () => {\n" \ - " if (this.#onDrain) {\n" \ - " const cb = this.#onDrain;\n" \ - " this.#onDrain = null;\n" \ - " cb();\n" \ - " }\n" \ - " });\n" \ - "\n" \ - " eos(writeStream, err => {\n" \ - " this.#writable = false;\n" \ - " if (err) {\n" \ - " destroy(writeStream, err);\n" \ - " }\n" \ - " this.#onFinished(err);\n" \ - " });\n" \ - "\n" \ - " return writeStream;\n" \ - " }\n" \ - "\n" \ - " _write(chunk, encoding, callback) {\n" \ - " var writeStream = this.#writeStream;\n" \ - " if (!writeStream) {\n" \ - " writeStream = this.#constructWriteStream();\n" \ - " }\n" \ - "\n" \ - " if (writeStream.write(chunk, encoding)) {\n" \ - " callback();\n" \ - " } else {\n" \ - " this.#onDrain = callback;\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " _final(callback) {\n" \ - " this.#writeStream.end();\n" \ - " this.#onFinish = (...args) => callback(...args);\n" \ - " }\n" \ - " };\n" \ - "\n" \ - " return new StdinStream();\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().processObjectInternalsBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().processObjectInternalsBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.h b/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.h deleted file mode 100644 index 4fcdb4810..000000000 --- a/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* ProcessObjectInternals */ -extern const char* const s_processObjectInternalsBindingCode; -extern const int s_processObjectInternalsBindingCodeLength; -extern const JSC::ConstructAbility s_processObjectInternalsBindingCodeConstructAbility; -extern const JSC::ConstructorKind s_processObjectInternalsBindingCodeConstructorKind; -extern const JSC::ImplementationVisibility s_processObjectInternalsBindingCodeImplementationVisibility; -extern const char* const s_processObjectInternalsGetStdioWriteStreamCode; -extern const int s_processObjectInternalsGetStdioWriteStreamCodeLength; -extern const JSC::ConstructAbility s_processObjectInternalsGetStdioWriteStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_processObjectInternalsGetStdioWriteStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_processObjectInternalsGetStdioWriteStreamCodeImplementationVisibility; -extern const char* const s_processObjectInternalsGetStdinStreamCode; -extern const int s_processObjectInternalsGetStdinStreamCodeLength; -extern const JSC::ConstructAbility s_processObjectInternalsGetStdinStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_processObjectInternalsGetStdinStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_processObjectInternalsGetStdinStreamCodeImplementationVisibility; - -#define WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_DATA(macro) \ - macro(binding, processObjectInternalsBinding, 1) \ - macro(getStdioWriteStream, processObjectInternalsGetStdioWriteStream, 2) \ - macro(getStdinStream, processObjectInternalsGetStdinStream, 3) \ - -#define WEBCORE_BUILTIN_PROCESSOBJECTINTERNALS_BINDING 1 -#define WEBCORE_BUILTIN_PROCESSOBJECTINTERNALS_GETSTDIOWRITESTREAM 1 -#define WEBCORE_BUILTIN_PROCESSOBJECTINTERNALS_GETSTDINSTREAM 1 - -#define WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(macro) \ - macro(processObjectInternalsBindingCode, binding, ASCIILiteral(), s_processObjectInternalsBindingCodeLength) \ - macro(processObjectInternalsGetStdioWriteStreamCode, getStdioWriteStream, ASCIILiteral(), s_processObjectInternalsGetStdioWriteStreamCodeLength) \ - macro(processObjectInternalsGetStdinStreamCode, getStdinStream, ASCIILiteral(), s_processObjectInternalsGetStdinStreamCodeLength) \ - -#define WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_FUNCTION_NAME(macro) \ - macro(binding) \ - macro(getStdinStream) \ - macro(getStdioWriteStream) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ProcessObjectInternalsBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ProcessObjectInternalsBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ProcessObjectInternalsBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ProcessObjectInternalsBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ReadableByteStreamControllerBuiltins.cpp b/src/bun.js/builtins/cpp/ReadableByteStreamControllerBuiltins.cpp deleted file mode 100644 index 9f431a8d0..000000000 --- a/src/bun.js/builtins/cpp/ReadableByteStreamControllerBuiltins.cpp +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "ReadableByteStreamControllerBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeLength = 366; -static const JSC::Intrinsic s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamControllerInitializeReadableByteStreamControllerCode = - "(function (stream, underlyingByteSource, highWaterMark)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (arguments.length !== 4 && arguments[3] !== @isReadableStream)\n" \ - " @throwTypeError(\"ReadableByteStreamController constructor should not be called directly\");\n" \ - "\n" \ - " return @privateInitializeReadableByteStreamController.@call(this, stream, underlyingByteSource, highWaterMark);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamControllerEnqueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamControllerEnqueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamControllerEnqueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamControllerEnqueueCodeLength = 665; -static const JSC::Intrinsic s_readableByteStreamControllerEnqueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamControllerEnqueueCode = - "(function (chunk)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableByteStreamController(this))\n" \ - " throw @makeThisTypeError(\"ReadableByteStreamController\", \"enqueue\");\n" \ - "\n" \ - " if (@getByIdDirectPrivate(this, \"closeRequested\"))\n" \ - " @throwTypeError(\"ReadableByteStreamController is requested to close\");\n" \ - "\n" \ - " if (@getByIdDirectPrivate(@getByIdDirectPrivate(this, \"controlledReadableStream\"), \"state\") !== @streamReadable)\n" \ - " @throwTypeError(\"ReadableStream is not readable\");\n" \ - "\n" \ - " if (!@isObject(chunk) || !@ArrayBuffer.@isView(chunk))\n" \ - " @throwTypeError(\"Provided chunk is not a TypedArray\");\n" \ - "\n" \ - " return @readableByteStreamControllerEnqueue(this, chunk);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamControllerErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamControllerErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamControllerErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamControllerErrorCodeLength = 396; -static const JSC::Intrinsic s_readableByteStreamControllerErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamControllerErrorCode = - "(function (error)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableByteStreamController(this))\n" \ - " throw @makeThisTypeError(\"ReadableByteStreamController\", \"error\");\n" \ - "\n" \ - " if (@getByIdDirectPrivate(@getByIdDirectPrivate(this, \"controlledReadableStream\"), \"state\") !== @streamReadable)\n" \ - " @throwTypeError(\"ReadableStream is not readable\");\n" \ - "\n" \ - " @readableByteStreamControllerError(this, error);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamControllerCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamControllerCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamControllerCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamControllerCloseCodeLength = 501; -static const JSC::Intrinsic s_readableByteStreamControllerCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamControllerCloseCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableByteStreamController(this))\n" \ - " throw @makeThisTypeError(\"ReadableByteStreamController\", \"close\");\n" \ - "\n" \ - " if (@getByIdDirectPrivate(this, \"closeRequested\"))\n" \ - " @throwTypeError(\"Close has already been requested\");\n" \ - "\n" \ - " if (@getByIdDirectPrivate(@getByIdDirectPrivate(this, \"controlledReadableStream\"), \"state\") !== @streamReadable)\n" \ - " @throwTypeError(\"ReadableStream is not readable\");\n" \ - "\n" \ - " @readableByteStreamControllerClose(this);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamControllerByobRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamControllerByobRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamControllerByobRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamControllerByobRequestCodeLength = 817; -static const JSC::Intrinsic s_readableByteStreamControllerByobRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamControllerByobRequestCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableByteStreamController(this))\n" \ - " throw @makeGetterTypeError(\"ReadableByteStreamController\", \"byobRequest\");\n" \ - "\n" \ - " \n" \ - " var request = @getByIdDirectPrivate(this, \"byobRequest\");\n" \ - " if (request === @undefined) {\n" \ - " var pending = @getByIdDirectPrivate(this, \"pendingPullIntos\");\n" \ - " const firstDescriptor = pending.peek();\n" \ - " if (firstDescriptor) {\n" \ - " const view = new @Uint8Array(firstDescriptor.buffer,\n" \ - " firstDescriptor.byteOffset + firstDescriptor.bytesFilled,\n" \ - " firstDescriptor.byteLength - firstDescriptor.bytesFilled);\n" \ - " @putByIdDirectPrivate(this, \"byobRequest\", new @ReadableStreamBYOBRequest(this, view, @isReadableStream));\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " return @getByIdDirectPrivate(this, \"byobRequest\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamControllerDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamControllerDesiredSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamControllerDesiredSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamControllerDesiredSizeCodeLength = 231; -static const JSC::Intrinsic s_readableByteStreamControllerDesiredSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamControllerDesiredSizeCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableByteStreamController(this))\n" \ - " throw @makeGetterTypeError(\"ReadableByteStreamController\", \"desiredSize\");\n" \ - "\n" \ - " return @readableByteStreamControllerGetDesiredSize(this);\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().readableByteStreamControllerBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().readableByteStreamControllerBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ReadableByteStreamControllerBuiltins.h b/src/bun.js/builtins/cpp/ReadableByteStreamControllerBuiltins.h deleted file mode 100644 index 20083abbb..000000000 --- a/src/bun.js/builtins/cpp/ReadableByteStreamControllerBuiltins.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* ReadableByteStreamController */ -extern const char* const s_readableByteStreamControllerInitializeReadableByteStreamControllerCode; -extern const int s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeImplementationVisibility; -extern const char* const s_readableByteStreamControllerEnqueueCode; -extern const int s_readableByteStreamControllerEnqueueCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamControllerEnqueueCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamControllerEnqueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamControllerEnqueueCodeImplementationVisibility; -extern const char* const s_readableByteStreamControllerErrorCode; -extern const int s_readableByteStreamControllerErrorCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamControllerErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamControllerErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamControllerErrorCodeImplementationVisibility; -extern const char* const s_readableByteStreamControllerCloseCode; -extern const int s_readableByteStreamControllerCloseCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamControllerCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamControllerCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamControllerCloseCodeImplementationVisibility; -extern const char* const s_readableByteStreamControllerByobRequestCode; -extern const int s_readableByteStreamControllerByobRequestCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamControllerByobRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamControllerByobRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamControllerByobRequestCodeImplementationVisibility; -extern const char* const s_readableByteStreamControllerDesiredSizeCode; -extern const int s_readableByteStreamControllerDesiredSizeCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamControllerDesiredSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamControllerDesiredSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamControllerDesiredSizeCodeImplementationVisibility; - -#define WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_DATA(macro) \ - macro(initializeReadableByteStreamController, readableByteStreamControllerInitializeReadableByteStreamController, 3) \ - macro(enqueue, readableByteStreamControllerEnqueue, 1) \ - macro(error, readableByteStreamControllerError, 1) \ - macro(close, readableByteStreamControllerClose, 0) \ - macro(byobRequest, readableByteStreamControllerByobRequest, 0) \ - macro(desiredSize, readableByteStreamControllerDesiredSize, 0) \ - -#define WEBCORE_BUILTIN_READABLEBYTESTREAMCONTROLLER_INITIALIZEREADABLEBYTESTREAMCONTROLLER 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMCONTROLLER_ENQUEUE 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMCONTROLLER_ERROR 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMCONTROLLER_CLOSE 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMCONTROLLER_BYOBREQUEST 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMCONTROLLER_DESIREDSIZE 1 - -#define WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_CODE(macro) \ - macro(readableByteStreamControllerInitializeReadableByteStreamControllerCode, initializeReadableByteStreamController, ASCIILiteral(), s_readableByteStreamControllerInitializeReadableByteStreamControllerCodeLength) \ - macro(readableByteStreamControllerEnqueueCode, enqueue, ASCIILiteral(), s_readableByteStreamControllerEnqueueCodeLength) \ - macro(readableByteStreamControllerErrorCode, error, ASCIILiteral(), s_readableByteStreamControllerErrorCodeLength) \ - macro(readableByteStreamControllerCloseCode, close, ASCIILiteral(), s_readableByteStreamControllerCloseCodeLength) \ - macro(readableByteStreamControllerByobRequestCode, byobRequest, "get byobRequest"_s, s_readableByteStreamControllerByobRequestCodeLength) \ - macro(readableByteStreamControllerDesiredSizeCode, desiredSize, "get desiredSize"_s, s_readableByteStreamControllerDesiredSizeCodeLength) \ - -#define WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_FUNCTION_NAME(macro) \ - macro(byobRequest) \ - macro(close) \ - macro(desiredSize) \ - macro(enqueue) \ - macro(error) \ - macro(initializeReadableByteStreamController) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ReadableByteStreamControllerBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ReadableByteStreamControllerBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ReadableByteStreamControllerBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ReadableByteStreamControllerBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_READABLEBYTESTREAMCONTROLLER_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ReadableByteStreamInternalsBuiltins.cpp b/src/bun.js/builtins/cpp/ReadableByteStreamInternalsBuiltins.cpp deleted file mode 100644 index 5d7e20a5c..000000000 --- a/src/bun.js/builtins/cpp/ReadableByteStreamInternalsBuiltins.cpp +++ /dev/null @@ -1,992 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "ReadableByteStreamInternalsBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeLength = 2365; -static const JSC::Intrinsic s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCode = - "(function (stream, underlyingByteSource, highWaterMark)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStream(stream))\n" \ - " @throwTypeError(\"ReadableByteStreamController needs a ReadableStream\");\n" \ - "\n" \ - " //\n" \ - " if (@getByIdDirectPrivate(stream, \"readableStreamController\") !== null)\n" \ - " @throwTypeError(\"ReadableStream already has a controller\");\n" \ - "\n" \ - " @putByIdDirectPrivate(this, \"controlledReadableStream\", stream);\n" \ - " @putByIdDirectPrivate(this, \"underlyingByteSource\", underlyingByteSource);\n" \ - " @putByIdDirectPrivate(this, \"pullAgain\", false);\n" \ - " @putByIdDirectPrivate(this, \"pulling\", false);\n" \ - " @readableByteStreamControllerClearPendingPullIntos(this);\n" \ - " @putByIdDirectPrivate(this, \"queue\", @newQueue());\n" \ - " @putByIdDirectPrivate(this, \"started\", 0);\n" \ - " @putByIdDirectPrivate(this, \"closeRequested\", false);\n" \ - "\n" \ - " let hwm = @toNumber(highWaterMark);\n" \ - " if (@isNaN(hwm) || hwm < 0)\n" \ - " @throwRangeError(\"highWaterMark value is negative or not a number\");\n" \ - " @putByIdDirectPrivate(this, \"strategyHWM\", hwm);\n" \ - "\n" \ - " let autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;\n" \ - " if (autoAllocateChunkSize !== @undefined) {\n" \ - " autoAllocateChunkSize = @toNumber(autoAllocateChunkSize);\n" \ - " if (autoAllocateChunkSize <= 0 || autoAllocateChunkSize === @Infinity || autoAllocateChunkSize === -@Infinity)\n" \ - " @throwRangeError(\"autoAllocateChunkSize value is negative or equal to positive or negative infinity\");\n" \ - " }\n" \ - " @putByIdDirectPrivate(this, \"autoAllocateChunkSize\", autoAllocateChunkSize);\n" \ - " @putByIdDirectPrivate(this, \"pendingPullIntos\", @createFIFO());\n" \ - "\n" \ - "\n" \ - " const controller = this;\n" \ - " @promiseInvokeOrNoopNoCatch(@getByIdDirectPrivate(controller, \"underlyingByteSource\"), \"start\", [controller]).@then(() => {\n" \ - " @putByIdDirectPrivate(controller, \"started\", 1);\n" \ - " @assert(!@getByIdDirectPrivate(controller, \"pulling\"));\n" \ - " @assert(!@getByIdDirectPrivate(controller, \"pullAgain\"));\n" \ - " @readableByteStreamControllerCallPullIfNeeded(controller);\n" \ - " }, (error) => {\n" \ - " if (@getByIdDirectPrivate(stream, \"state\") === @streamReadable)\n" \ - " @readableByteStreamControllerError(controller, error);\n" \ - " });\n" \ - "\n" \ - " @putByIdDirectPrivate(this, \"cancel\", @readableByteStreamControllerCancel);\n" \ - " @putByIdDirectPrivate(this, \"pull\", @readableByteStreamControllerPull);\n" \ - " \n" \ - " return this;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeLength = 107; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCode = - "(function (controller) {\n" \ - " \"use strict\";\n" \ - " @putByIdDirectPrivate(controller, \"start\", @undefined);\n" \ - "\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeLength = 187; -static const JSC::Intrinsic s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCode = - "(function (controller, view)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @putByIdDirectPrivate(this, \"associatedReadableByteStreamController\", controller);\n" \ - " @putByIdDirectPrivate(this, \"view\", view);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsIsReadableByteStreamControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsIsReadableByteStreamControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsIsReadableByteStreamControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsIsReadableByteStreamControllerCodeLength = 158; -static const JSC::Intrinsic s_readableByteStreamInternalsIsReadableByteStreamControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsIsReadableByteStreamControllerCode = - "(function (controller)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " //\n" \ - " //\n" \ - " return @isObject(controller) && !!@getByIdDirectPrivate(controller, \"underlyingByteSource\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeLength = 179; -static const JSC::Intrinsic s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsIsReadableStreamBYOBRequestCode = - "(function (byobRequest)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " //\n" \ - " //\n" \ - " return @isObject(byobRequest) && !!@getByIdDirectPrivate(byobRequest, \"associatedReadableByteStreamController\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeLength = 149; -static const JSC::Intrinsic s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsIsReadableStreamBYOBReaderCode = - "(function (reader)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " return @isObject(reader) && !!@getByIdDirectPrivate(reader, \"readIntoRequests\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeLength = 398; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerCancelCode = - "(function (controller, reason)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " var pendingPullIntos = @getByIdDirectPrivate(controller, \"pendingPullIntos\");\n" \ - " var first = pendingPullIntos.peek();\n" \ - " if (first)\n" \ - " first.bytesFilled = 0;\n" \ - "\n" \ - " @putByIdDirectPrivate(controller, \"queue\", @newQueue());\n" \ - " return @promiseInvokeOrNoop(@getByIdDirectPrivate(controller, \"underlyingByteSource\"), \"cancel\", [reason]);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeLength = 399; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerErrorCode = - "(function (controller, e)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@getByIdDirectPrivate(@getByIdDirectPrivate(controller, \"controlledReadableStream\"), \"state\") === @streamReadable);\n" \ - " @readableByteStreamControllerClearPendingPullIntos(controller);\n" \ - " @putByIdDirectPrivate(controller, \"queue\", @newQueue());\n" \ - " @readableStreamError(@getByIdDirectPrivate(controller, \"controlledReadableStream\"), e);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeLength = 809; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerCloseCode = - "(function (controller)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(!@getByIdDirectPrivate(controller, \"closeRequested\"));\n" \ - " @assert(@getByIdDirectPrivate(@getByIdDirectPrivate(controller, \"controlledReadableStream\"), \"state\") === @streamReadable);\n" \ - "\n" \ - " if (@getByIdDirectPrivate(controller, \"queue\").size > 0) {\n" \ - " @putByIdDirectPrivate(controller, \"closeRequested\", true);\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " var first = @getByIdDirectPrivate(controller, \"pendingPullIntos\")?.peek();\n" \ - " if (first) {\n" \ - " if (first.bytesFilled > 0) {\n" \ - " const e = @makeTypeError(\"Close requested while there remain pending bytes\");\n" \ - " @readableByteStreamControllerError(controller, e);\n" \ - " throw e;\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " @readableStreamClose(@getByIdDirectPrivate(controller, \"controlledReadableStream\"));\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeLength = 347; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCode = - "(function (controller)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @readableByteStreamControllerInvalidateBYOBRequest(controller);\n" \ - " var existing = @getByIdDirectPrivate(controller, \"pendingPullIntos\");\n" \ - " if (existing !== @undefined) {\n" \ - " existing.clear();\n" \ - " } else {\n" \ - " @putByIdDirectPrivate(controller, \"pendingPullIntos\", @createFIFO());\n" \ - " }\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeLength = 406; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCode = - "(function (controller)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - "\n" \ - " if (state === @streamErrored)\n" \ - " return null;\n" \ - " if (state === @streamClosed)\n" \ - " return 0;\n" \ - "\n" \ - " return @getByIdDirectPrivate(controller, \"strategyHWM\") - @getByIdDirectPrivate(controller, \"queue\").size;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeLength = 176; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableStreamHasBYOBReaderCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const reader = @getByIdDirectPrivate(stream, \"reader\");\n" \ - " return reader !== @undefined && @isReadableStreamBYOBReader(reader);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeLength = 179; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableStreamHasDefaultReaderCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const reader = @getByIdDirectPrivate(stream, \"reader\");\n" \ - " return reader !== @undefined && @isReadableStreamDefaultReader(reader);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeLength = 458; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCode = - "(function (controller) {\n" \ - "\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@getByIdDirectPrivate(@getByIdDirectPrivate(controller, \"controlledReadableStream\"), \"state\") === @streamReadable);\n" \ - " if (!@getByIdDirectPrivate(controller, \"queue\").size && @getByIdDirectPrivate(controller, \"closeRequested\"))\n" \ - " @readableStreamClose(@getByIdDirectPrivate(controller, \"controlledReadableStream\"));\n" \ - " else\n" \ - " @readableByteStreamControllerCallPullIfNeeded(controller);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerPullCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerPullCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerPullCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerPullCodeLength = 1610; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerPullCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerPullCode = - "(function (controller)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n" \ - " @assert(@readableStreamHasDefaultReader(stream));\n" \ - " if (@getByIdDirectPrivate(controller, \"queue\").content?.isNotEmpty()) {\n" \ - " const entry = @getByIdDirectPrivate(controller, \"queue\").content.shift();\n" \ - " @getByIdDirectPrivate(controller, \"queue\").size -= entry.byteLength;\n" \ - " @readableByteStreamControllerHandleQueueDrain(controller);\n" \ - " let view;\n" \ - " try {\n" \ - " view = new @Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);\n" \ - " } catch (error) {\n" \ - " return @Promise.@reject(error);\n" \ - " }\n" \ - " return @createFulfilledPromise({ value: view, done: false });\n" \ - " }\n" \ - "\n" \ - " if (@getByIdDirectPrivate(controller, \"autoAllocateChunkSize\") !== @undefined) {\n" \ - " let buffer;\n" \ - " try {\n" \ - " buffer = @createUninitializedArrayBuffer(@getByIdDirectPrivate(controller, \"autoAllocateChunkSize\"));\n" \ - " } catch (error) {\n" \ - " return @Promise.@reject(error);\n" \ - " }\n" \ - " const pullIntoDescriptor = {\n" \ - " buffer,\n" \ - " byteOffset: 0,\n" \ - " byteLength: @getByIdDirectPrivate(controller, \"autoAllocateChunkSize\"),\n" \ - " bytesFilled: 0,\n" \ - " elementSize: 1,\n" \ - " ctor: @Uint8Array,\n" \ - " readerType: 'default'\n" \ - " };\n" \ - " @getByIdDirectPrivate(controller, \"pendingPullIntos\").push(pullIntoDescriptor);\n" \ - " }\n" \ - "\n" \ - " const promise = @readableStreamAddReadRequest(stream);\n" \ - " @readableByteStreamControllerCallPullIfNeeded(controller);\n" \ - " return promise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeLength = 879; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCode = - "(function (controller)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n" \ - "\n" \ - " if (@getByIdDirectPrivate(stream, \"state\") !== @streamReadable)\n" \ - " return false;\n" \ - " if (@getByIdDirectPrivate(controller, \"closeRequested\"))\n" \ - " return false;\n" \ - " if (!(@getByIdDirectPrivate(controller, \"started\") > 0))\n" \ - " return false;\n" \ - " const reader = @getByIdDirectPrivate(stream, \"reader\");\n" \ - " \n" \ - " if (reader && (@getByIdDirectPrivate(reader, \"readRequests\")?.isNotEmpty() || !!@getByIdDirectPrivate(reader, \"bunNativePtr\")))\n" \ - " return true;\n" \ - " if (@readableStreamHasBYOBReader(stream) && @getByIdDirectPrivate(@getByIdDirectPrivate(stream, \"reader\"), \"readIntoRequests\")?.isNotEmpty())\n" \ - " return true;\n" \ - " if (@readableByteStreamControllerGetDesiredSize(controller) > 0)\n" \ - " return true;\n" \ - " return false;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeLength = 1002; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCode = - "(function (controller)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@readableByteStreamControllerShouldCallPull(controller))\n" \ - " return;\n" \ - "\n" \ - " if (@getByIdDirectPrivate(controller, \"pulling\")) {\n" \ - " @putByIdDirectPrivate(controller, \"pullAgain\", true);\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " @assert(!@getByIdDirectPrivate(controller, \"pullAgain\"));\n" \ - " @putByIdDirectPrivate(controller, \"pulling\", true);\n" \ - " @promiseInvokeOrNoop(@getByIdDirectPrivate(controller, \"underlyingByteSource\"), \"pull\", [controller]).@then(() => {\n" \ - " @putByIdDirectPrivate(controller, \"pulling\", false);\n" \ - " if (@getByIdDirectPrivate(controller, \"pullAgain\")) {\n" \ - " @putByIdDirectPrivate(controller, \"pullAgain\", false);\n" \ - " @readableByteStreamControllerCallPullIfNeeded(controller);\n" \ - " }\n" \ - " }, (error) => {\n" \ - " if (@getByIdDirectPrivate(@getByIdDirectPrivate(controller, \"controlledReadableStream\"), \"state\") === @streamReadable)\n" \ - " @readableByteStreamControllerError(controller, error);\n" \ - " });\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeLength = 90; -static const JSC::Intrinsic s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsTransferBufferToCurrentRealmCode = - "(function (buffer)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " return buffer;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamReaderKindCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamReaderKindCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamReaderKindCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableStreamReaderKindCodeLength = 266; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableStreamReaderKindCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableStreamReaderKindCode = - "(function (reader) {\n" \ - " \"use strict\";\n" \ - "\n" \ - "\n" \ - " if (!!@getByIdDirectPrivate(reader, \"readRequests\"))\n" \ - " return @getByIdDirectPrivate(reader, \"bunNativePtr\") ? 3 : 1;\n" \ - "\n" \ - " if (!!@getByIdDirectPrivate(reader, \"readIntoRequests\"))\n" \ - " return 2;\n" \ - "\n" \ - " return 0;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeLength = 1690; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCode = - "(function (controller, chunk)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n" \ - " @assert(!@getByIdDirectPrivate(controller, \"closeRequested\"));\n" \ - " @assert(@getByIdDirectPrivate(stream, \"state\") === @streamReadable);\n" \ - "\n" \ - "\n" \ - " switch (@getByIdDirectPrivate(stream, \"reader\") ? @readableStreamReaderKind(@getByIdDirectPrivate(stream, \"reader\")) : 0) {\n" \ - " \n" \ - " case 1: {\n" \ - " if (!@getByIdDirectPrivate(@getByIdDirectPrivate(stream, \"reader\"), \"readRequests\")?.isNotEmpty())\n" \ - " @readableByteStreamControllerEnqueueChunk(controller, @transferBufferToCurrentRealm(chunk.buffer), chunk.byteOffset, chunk.byteLength);\n" \ - " else {\n" \ - " @assert(!@getByIdDirectPrivate(controller, \"queue\").content.size());\n" \ - " const transferredView = chunk.constructor === @Uint8Array ? chunk : new @Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);\n" \ - " @readableStreamFulfillReadRequest(stream, transferredView, false);\n" \ - " }\n" \ - " break;\n" \ - " }\n" \ - "\n" \ - " \n" \ - " case 2: {\n" \ - " @readableByteStreamControllerEnqueueChunk(controller, @transferBufferToCurrentRealm(chunk.buffer), chunk.byteOffset, chunk.byteLength);\n" \ - " @readableByteStreamControllerProcessPullDescriptors(controller);\n" \ - " break;\n" \ - " }\n" \ - "\n" \ - " \n" \ - " case 3: {\n" \ - " //\n" \ - "\n" \ - " break;\n" \ - " }\n" \ - "\n" \ - " default: {\n" \ - " @assert(!@isReadableStreamLocked(stream));\n" \ - " @readableByteStreamControllerEnqueueChunk(controller, @transferBufferToCurrentRealm(chunk.buffer), chunk.byteOffset, chunk.byteLength);\n" \ - " break;\n" \ - " }\n" \ - " }\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeLength = 303; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCode = - "(function (controller, buffer, byteOffset, byteLength)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @getByIdDirectPrivate(controller, \"queue\").content.push({\n" \ - " buffer: buffer,\n" \ - " byteOffset: byteOffset,\n" \ - " byteLength: byteLength\n" \ - " });\n" \ - " @getByIdDirectPrivate(controller, \"queue\").size += byteLength;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeLength = 619; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCode = - "(function (controller, view)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@getByIdDirectPrivate(controller, \"pendingPullIntos\").isNotEmpty());\n" \ - "\n" \ - " let firstDescriptor = @getByIdDirectPrivate(controller, \"pendingPullIntos\").peek();\n" \ - " \n" \ - " if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !== view.byteOffset)\n" \ - " @throwRangeError(\"Invalid value for view.byteOffset\");\n" \ - "\n" \ - " if (firstDescriptor.byteLength !== view.byteLength)\n" \ - " @throwRangeError(\"Invalid value for view.byteLength\");\n" \ - "\n" \ - " firstDescriptor.buffer = view.buffer;\n" \ - " @readableByteStreamControllerRespondInternal(controller, view.byteLength);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeLength = 411; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondCode = - "(function (controller, bytesWritten)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " bytesWritten = @toNumber(bytesWritten);\n" \ - "\n" \ - " if (@isNaN(bytesWritten) || bytesWritten === @Infinity || bytesWritten < 0 )\n" \ - " @throwRangeError(\"bytesWritten has an incorrect value\");\n" \ - "\n" \ - " @assert(@getByIdDirectPrivate(controller, \"pendingPullIntos\").isNotEmpty());\n" \ - "\n" \ - " @readableByteStreamControllerRespondInternal(controller, bytesWritten);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeLength = 712; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCode = - "(function (controller, bytesWritten)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " let firstDescriptor = @getByIdDirectPrivate(controller, \"pendingPullIntos\").peek();\n" \ - " let stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n" \ - "\n" \ - " if (@getByIdDirectPrivate(stream, \"state\") === @streamClosed) {\n" \ - " if (bytesWritten !== 0)\n" \ - " @throwTypeError(\"bytesWritten is different from 0 even though stream is closed\");\n" \ - " @readableByteStreamControllerRespondInClosedState(controller, firstDescriptor);\n" \ - " } else {\n" \ - " @assert(@getByIdDirectPrivate(stream, \"state\") === @streamReadable);\n" \ - " @readableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor);\n" \ - " }\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeLength = 1440; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCode = - "(function (controller, bytesWritten, pullIntoDescriptor)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (pullIntoDescriptor.bytesFilled + bytesWritten > pullIntoDescriptor.byteLength)\n" \ - " @throwRangeError(\"bytesWritten value is too great\");\n" \ - "\n" \ - " @assert(@getByIdDirectPrivate(controller, \"pendingPullIntos\").isEmpty() || @getByIdDirectPrivate(controller, \"pendingPullIntos\").peek() === pullIntoDescriptor);\n" \ - " @readableByteStreamControllerInvalidateBYOBRequest(controller);\n" \ - " pullIntoDescriptor.bytesFilled += bytesWritten;\n" \ - "\n" \ - " if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize)\n" \ - " return;\n" \ - "\n" \ - " @readableByteStreamControllerShiftPendingDescriptor(controller);\n" \ - " const remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize;\n" \ - "\n" \ - " if (remainderSize > 0) {\n" \ - " const end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;\n" \ - " const remainder = @cloneArrayBuffer(pullIntoDescriptor.buffer, end - remainderSize, remainderSize);\n" \ - " @readableByteStreamControllerEnqueueChunk(controller, remainder, 0, remainder.byteLength);\n" \ - " }\n" \ - "\n" \ - " pullIntoDescriptor.buffer = @transferBufferToCurrentRealm(pullIntoDescriptor.buffer);\n" \ - " pullIntoDescriptor.bytesFilled -= remainderSize;\n" \ - " @readableByteStreamControllerCommitDescriptor(@getByIdDirectPrivate(controller, \"controlledReadableStream\"), pullIntoDescriptor);\n" \ - " @readableByteStreamControllerProcessPullDescriptors(controller);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeLength = 730; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCode = - "(function (controller, firstDescriptor)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " firstDescriptor.buffer = @transferBufferToCurrentRealm(firstDescriptor.buffer);\n" \ - " @assert(firstDescriptor.bytesFilled === 0);\n" \ - "\n" \ - " if (@readableStreamHasBYOBReader(@getByIdDirectPrivate(controller, \"controlledReadableStream\"))) {\n" \ - " while (@getByIdDirectPrivate(@getByIdDirectPrivate(@getByIdDirectPrivate(controller, \"controlledReadableStream\"), \"reader\"), \"readIntoRequests\")?.isNotEmpty()) {\n" \ - " let pullIntoDescriptor = @readableByteStreamControllerShiftPendingDescriptor(controller);\n" \ - " @readableByteStreamControllerCommitDescriptor(@getByIdDirectPrivate(controller, \"controlledReadableStream\"), pullIntoDescriptor);\n" \ - " }\n" \ - " }\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeLength = 712; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCode = - "(function (controller)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(!@getByIdDirectPrivate(controller, \"closeRequested\"));\n" \ - " while (@getByIdDirectPrivate(controller, \"pendingPullIntos\").isNotEmpty()) {\n" \ - " if (@getByIdDirectPrivate(controller, \"queue\").size === 0)\n" \ - " return;\n" \ - " let pullIntoDescriptor = @getByIdDirectPrivate(controller, \"pendingPullIntos\").peek();\n" \ - " if (@readableByteStreamControllerFillDescriptorFromQueue(controller, pullIntoDescriptor)) {\n" \ - " @readableByteStreamControllerShiftPendingDescriptor(controller);\n" \ - " @readableByteStreamControllerCommitDescriptor(@getByIdDirectPrivate(controller, \"controlledReadableStream\"), pullIntoDescriptor);\n" \ - " }\n" \ - " }\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeLength = 2359; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCode = - "(function (controller, pullIntoDescriptor)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const currentAlignedBytes = pullIntoDescriptor.bytesFilled - (pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize);\n" \ - " const maxBytesToCopy = @getByIdDirectPrivate(controller, \"queue\").size < pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled ?\n" \ - " @getByIdDirectPrivate(controller, \"queue\").size : pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled;\n" \ - " const maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy;\n" \ - " const maxAlignedBytes = maxBytesFilled - (maxBytesFilled % pullIntoDescriptor.elementSize);\n" \ - " let totalBytesToCopyRemaining = maxBytesToCopy;\n" \ - " let ready = false;\n" \ - "\n" \ - " if (maxAlignedBytes > currentAlignedBytes) {\n" \ - " totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled;\n" \ - " ready = true;\n" \ - " }\n" \ - "\n" \ - " while (totalBytesToCopyRemaining > 0) {\n" \ - " let headOfQueue = @getByIdDirectPrivate(controller, \"queue\").content.peek();\n" \ - " const bytesToCopy = totalBytesToCopyRemaining < headOfQueue.byteLength ? totalBytesToCopyRemaining : headOfQueue.byteLength;\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " const destStart = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;\n" \ - " //\n" \ - " //\n" \ - " new @Uint8Array(pullIntoDescriptor.buffer).set(new @Uint8Array(headOfQueue.buffer, headOfQueue.byteOffset, bytesToCopy), destStart);\n" \ - "\n" \ - " if (headOfQueue.byteLength === bytesToCopy)\n" \ - " @getByIdDirectPrivate(controller, \"queue\").content.shift();\n" \ - " else {\n" \ - " headOfQueue.byteOffset += bytesToCopy;\n" \ - " headOfQueue.byteLength -= bytesToCopy;\n" \ - " }\n" \ - "\n" \ - " @getByIdDirectPrivate(controller, \"queue\").size -= bytesToCopy;\n" \ - " @assert(@getByIdDirectPrivate(controller, \"pendingPullIntos\").isEmpty() || @getByIdDirectPrivate(controller, \"pendingPullIntos\").peek() === pullIntoDescriptor);\n" \ - " @readableByteStreamControllerInvalidateBYOBRequest(controller);\n" \ - " pullIntoDescriptor.bytesFilled += bytesToCopy;\n" \ - " totalBytesToCopyRemaining -= bytesToCopy;\n" \ - " }\n" \ - "\n" \ - " if (!ready) {\n" \ - " @assert(@getByIdDirectPrivate(controller, \"queue\").size === 0);\n" \ - " @assert(pullIntoDescriptor.bytesFilled > 0);\n" \ - " @assert(pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize);\n" \ - " }\n" \ - "\n" \ - " return ready;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeLength = 222; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCode = - "(function (controller)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " let descriptor = @getByIdDirectPrivate(controller, \"pendingPullIntos\").shift();\n" \ - " @readableByteStreamControllerInvalidateBYOBRequest(controller);\n" \ - " return descriptor;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeLength = 430; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCode = - "(function (controller)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (@getByIdDirectPrivate(controller, \"byobRequest\") === @undefined)\n" \ - " return;\n" \ - " const byobRequest = @getByIdDirectPrivate(controller, \"byobRequest\");\n" \ - " @putByIdDirectPrivate(byobRequest, \"associatedReadableByteStreamController\", @undefined);\n" \ - " @putByIdDirectPrivate(byobRequest, \"view\", @undefined);\n" \ - " @putByIdDirectPrivate(controller, \"byobRequest\", @undefined);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeLength = 662; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCode = - "(function (stream, pullIntoDescriptor)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@getByIdDirectPrivate(stream, \"state\") !== @streamErrored);\n" \ - " let done = false;\n" \ - " if (@getByIdDirectPrivate(stream, \"state\") === @streamClosed) {\n" \ - " @assert(!pullIntoDescriptor.bytesFilled);\n" \ - " done = true;\n" \ - " }\n" \ - " let filledView = @readableByteStreamControllerConvertDescriptor(pullIntoDescriptor);\n" \ - " if (pullIntoDescriptor.readerType === \"default\")\n" \ - " @readableStreamFulfillReadRequest(stream, filledView, done);\n" \ - " else {\n" \ - " @assert(pullIntoDescriptor.readerType === \"byob\");\n" \ - " @readableStreamFulfillReadIntoRequest(stream, filledView, done);\n" \ - " }\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeLength = 381; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCode = - "(function (pullIntoDescriptor)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(pullIntoDescriptor.bytesFilled <= pullIntoDescriptor.byteLength);\n" \ - " @assert(pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize === 0);\n" \ - "\n" \ - " return new pullIntoDescriptor.ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, pullIntoDescriptor.bytesFilled / pullIntoDescriptor.elementSize);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeLength = 243; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCode = - "(function (stream, chunk, done)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " const readIntoRequest = @getByIdDirectPrivate(@getByIdDirectPrivate(stream, \"reader\"), \"readIntoRequests\").shift();\n" \ - " @fulfillPromise(readIntoRequest, { value: chunk, done: done });\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeLength = 462; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableStreamBYOBReaderReadCode = - "(function (reader, view)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(reader, \"ownerReadableStream\");\n" \ - " @assert(!!stream);\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"disturbed\", true);\n" \ - " if (@getByIdDirectPrivate(stream, \"state\") === @streamErrored)\n" \ - " return @Promise.@reject(@getByIdDirectPrivate(stream, \"storedError\"));\n" \ - "\n" \ - " return @readableByteStreamControllerPullInto(@getByIdDirectPrivate(stream, \"readableStreamController\"), view);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeLength = 2190; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCode = - "(function (controller, view)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n" \ - " let elementSize = 1;\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " if (view.BYTES_PER_ELEMENT !== @undefined)\n" \ - " elementSize = view.BYTES_PER_ELEMENT;\n" \ - "\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " const ctor = view.constructor;\n" \ - "\n" \ - " const pullIntoDescriptor = {\n" \ - " buffer: view.buffer,\n" \ - " byteOffset: view.byteOffset,\n" \ - " byteLength: view.byteLength,\n" \ - " bytesFilled: 0,\n" \ - " elementSize,\n" \ - " ctor,\n" \ - " readerType: 'byob'\n" \ - " };\n" \ - "\n" \ - " var pending = @getByIdDirectPrivate(controller, \"pendingPullIntos\");\n" \ - " if (pending?.isNotEmpty()) {\n" \ - " pullIntoDescriptor.buffer = @transferBufferToCurrentRealm(pullIntoDescriptor.buffer);\n" \ - " pending.push(pullIntoDescriptor);\n" \ - " return @readableStreamAddReadIntoRequest(stream);\n" \ - " }\n" \ - "\n" \ - " if (@getByIdDirectPrivate(stream, \"state\") === @streamClosed) {\n" \ - " const emptyView = new ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, 0);\n" \ - " return @createFulfilledPromise({ value: emptyView, done: true });\n" \ - " }\n" \ - "\n" \ - " if (@getByIdDirectPrivate(controller, \"queue\").size > 0) {\n" \ - " if (@readableByteStreamControllerFillDescriptorFromQueue(controller, pullIntoDescriptor)) {\n" \ - " const filledView = @readableByteStreamControllerConvertDescriptor(pullIntoDescriptor);\n" \ - " @readableByteStreamControllerHandleQueueDrain(controller);\n" \ - " return @createFulfilledPromise({ value: filledView, done: false });\n" \ - " }\n" \ - " if (@getByIdDirectPrivate(controller, \"closeRequested\")) {\n" \ - " const e = @makeTypeError(\"Closing stream has been requested\");\n" \ - " @readableByteStreamControllerError(controller, e);\n" \ - " return @Promise.@reject(e);\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " pullIntoDescriptor.buffer = @transferBufferToCurrentRealm(pullIntoDescriptor.buffer);\n" \ - " @getByIdDirectPrivate(controller, \"pendingPullIntos\").push(pullIntoDescriptor);\n" \ - " const promise = @readableStreamAddReadIntoRequest(stream);\n" \ - " @readableByteStreamControllerCallPullIfNeeded(controller);\n" \ - " return promise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeLength = 430; -static const JSC::Intrinsic s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@isReadableStreamBYOBReader(@getByIdDirectPrivate(stream, \"reader\")));\n" \ - " @assert(@getByIdDirectPrivate(stream, \"state\") === @streamReadable || @getByIdDirectPrivate(stream, \"state\") === @streamClosed);\n" \ - "\n" \ - " const readRequest = @newPromise();\n" \ - " @getByIdDirectPrivate(@getByIdDirectPrivate(stream, \"reader\"), \"readIntoRequests\").push(readRequest);\n" \ - "\n" \ - " return readRequest;\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().readableByteStreamInternalsBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().readableByteStreamInternalsBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ReadableByteStreamInternalsBuiltins.h b/src/bun.js/builtins/cpp/ReadableByteStreamInternalsBuiltins.h deleted file mode 100644 index aa140d53e..000000000 --- a/src/bun.js/builtins/cpp/ReadableByteStreamInternalsBuiltins.h +++ /dev/null @@ -1,480 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* ReadableByteStreamInternals */ -extern const char* const s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCode; -extern const int s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCode; -extern const int s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCode; -extern const int s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsIsReadableByteStreamControllerCode; -extern const int s_readableByteStreamInternalsIsReadableByteStreamControllerCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsIsReadableByteStreamControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsIsReadableByteStreamControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsIsReadableByteStreamControllerCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsIsReadableStreamBYOBRequestCode; -extern const int s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsIsReadableStreamBYOBReaderCode; -extern const int s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerCancelCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerErrorCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerCloseCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableStreamHasBYOBReaderCode; -extern const int s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableStreamHasDefaultReaderCode; -extern const int s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerPullCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerPullCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerPullCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerPullCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerPullCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsTransferBufferToCurrentRealmCode; -extern const int s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableStreamReaderKindCode; -extern const int s_readableByteStreamInternalsReadableStreamReaderKindCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamReaderKindCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamReaderKindCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamReaderKindCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCode; -extern const int s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableStreamBYOBReaderReadCode; -extern const int s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCode; -extern const int s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeImplementationVisibility; -extern const char* const s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCode; -extern const int s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeLength; -extern const JSC::ConstructAbility s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeImplementationVisibility; - -#define WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_DATA(macro) \ - macro(privateInitializeReadableByteStreamController, readableByteStreamInternalsPrivateInitializeReadableByteStreamController, 3) \ - macro(readableStreamByteStreamControllerStart, readableByteStreamInternalsReadableStreamByteStreamControllerStart, 1) \ - macro(privateInitializeReadableStreamBYOBRequest, readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequest, 2) \ - macro(isReadableByteStreamController, readableByteStreamInternalsIsReadableByteStreamController, 1) \ - macro(isReadableStreamBYOBRequest, readableByteStreamInternalsIsReadableStreamBYOBRequest, 1) \ - macro(isReadableStreamBYOBReader, readableByteStreamInternalsIsReadableStreamBYOBReader, 1) \ - macro(readableByteStreamControllerCancel, readableByteStreamInternalsReadableByteStreamControllerCancel, 2) \ - macro(readableByteStreamControllerError, readableByteStreamInternalsReadableByteStreamControllerError, 2) \ - macro(readableByteStreamControllerClose, readableByteStreamInternalsReadableByteStreamControllerClose, 1) \ - macro(readableByteStreamControllerClearPendingPullIntos, readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntos, 1) \ - macro(readableByteStreamControllerGetDesiredSize, readableByteStreamInternalsReadableByteStreamControllerGetDesiredSize, 1) \ - macro(readableStreamHasBYOBReader, readableByteStreamInternalsReadableStreamHasBYOBReader, 1) \ - macro(readableStreamHasDefaultReader, readableByteStreamInternalsReadableStreamHasDefaultReader, 1) \ - macro(readableByteStreamControllerHandleQueueDrain, readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrain, 1) \ - macro(readableByteStreamControllerPull, readableByteStreamInternalsReadableByteStreamControllerPull, 1) \ - macro(readableByteStreamControllerShouldCallPull, readableByteStreamInternalsReadableByteStreamControllerShouldCallPull, 1) \ - macro(readableByteStreamControllerCallPullIfNeeded, readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeeded, 1) \ - macro(transferBufferToCurrentRealm, readableByteStreamInternalsTransferBufferToCurrentRealm, 1) \ - macro(readableStreamReaderKind, readableByteStreamInternalsReadableStreamReaderKind, 1) \ - macro(readableByteStreamControllerEnqueue, readableByteStreamInternalsReadableByteStreamControllerEnqueue, 2) \ - macro(readableByteStreamControllerEnqueueChunk, readableByteStreamInternalsReadableByteStreamControllerEnqueueChunk, 4) \ - macro(readableByteStreamControllerRespondWithNewView, readableByteStreamInternalsReadableByteStreamControllerRespondWithNewView, 2) \ - macro(readableByteStreamControllerRespond, readableByteStreamInternalsReadableByteStreamControllerRespond, 2) \ - macro(readableByteStreamControllerRespondInternal, readableByteStreamInternalsReadableByteStreamControllerRespondInternal, 2) \ - macro(readableByteStreamControllerRespondInReadableState, readableByteStreamInternalsReadableByteStreamControllerRespondInReadableState, 3) \ - macro(readableByteStreamControllerRespondInClosedState, readableByteStreamInternalsReadableByteStreamControllerRespondInClosedState, 2) \ - macro(readableByteStreamControllerProcessPullDescriptors, readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptors, 1) \ - macro(readableByteStreamControllerFillDescriptorFromQueue, readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueue, 2) \ - macro(readableByteStreamControllerShiftPendingDescriptor, readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptor, 1) \ - macro(readableByteStreamControllerInvalidateBYOBRequest, readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequest, 1) \ - macro(readableByteStreamControllerCommitDescriptor, readableByteStreamInternalsReadableByteStreamControllerCommitDescriptor, 2) \ - macro(readableByteStreamControllerConvertDescriptor, readableByteStreamInternalsReadableByteStreamControllerConvertDescriptor, 1) \ - macro(readableStreamFulfillReadIntoRequest, readableByteStreamInternalsReadableStreamFulfillReadIntoRequest, 3) \ - macro(readableStreamBYOBReaderRead, readableByteStreamInternalsReadableStreamBYOBReaderRead, 2) \ - macro(readableByteStreamControllerPullInto, readableByteStreamInternalsReadableByteStreamControllerPullInto, 2) \ - macro(readableStreamAddReadIntoRequest, readableByteStreamInternalsReadableStreamAddReadIntoRequest, 1) \ - -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_PRIVATEINITIALIZEREADABLEBYTESTREAMCONTROLLER 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLESTREAMBYTESTREAMCONTROLLERSTART 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_PRIVATEINITIALIZEREADABLESTREAMBYOBREQUEST 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_ISREADABLEBYTESTREAMCONTROLLER 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_ISREADABLESTREAMBYOBREQUEST 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_ISREADABLESTREAMBYOBREADER 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERCANCEL 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERERROR 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERCLOSE 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERCLEARPENDINGPULLINTOS 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERGETDESIREDSIZE 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLESTREAMHASBYOBREADER 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLESTREAMHASDEFAULTREADER 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERHANDLEQUEUEDRAIN 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERPULL 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERSHOULDCALLPULL 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERCALLPULLIFNEEDED 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_TRANSFERBUFFERTOCURRENTREALM 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLESTREAMREADERKIND 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERENQUEUE 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERENQUEUECHUNK 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERRESPONDWITHNEWVIEW 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERRESPOND 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERRESPONDINTERNAL 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERRESPONDINREADABLESTATE 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERRESPONDINCLOSEDSTATE 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERPROCESSPULLDESCRIPTORS 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERFILLDESCRIPTORFROMQUEUE 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERSHIFTPENDINGDESCRIPTOR 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERINVALIDATEBYOBREQUEST 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERCOMMITDESCRIPTOR 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERCONVERTDESCRIPTOR 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLESTREAMFULFILLREADINTOREQUEST 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLESTREAMBYOBREADERREAD 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLEBYTESTREAMCONTROLLERPULLINTO 1 -#define WEBCORE_BUILTIN_READABLEBYTESTREAMINTERNALS_READABLESTREAMADDREADINTOREQUEST 1 - -#define WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_CODE(macro) \ - macro(readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCode, privateInitializeReadableByteStreamController, ASCIILiteral(), s_readableByteStreamInternalsPrivateInitializeReadableByteStreamControllerCodeLength) \ - macro(readableByteStreamInternalsReadableStreamByteStreamControllerStartCode, readableStreamByteStreamControllerStart, ASCIILiteral(), s_readableByteStreamInternalsReadableStreamByteStreamControllerStartCodeLength) \ - macro(readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCode, privateInitializeReadableStreamBYOBRequest, ASCIILiteral(), s_readableByteStreamInternalsPrivateInitializeReadableStreamBYOBRequestCodeLength) \ - macro(readableByteStreamInternalsIsReadableByteStreamControllerCode, isReadableByteStreamController, ASCIILiteral(), s_readableByteStreamInternalsIsReadableByteStreamControllerCodeLength) \ - macro(readableByteStreamInternalsIsReadableStreamBYOBRequestCode, isReadableStreamBYOBRequest, ASCIILiteral(), s_readableByteStreamInternalsIsReadableStreamBYOBRequestCodeLength) \ - macro(readableByteStreamInternalsIsReadableStreamBYOBReaderCode, isReadableStreamBYOBReader, ASCIILiteral(), s_readableByteStreamInternalsIsReadableStreamBYOBReaderCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerCancelCode, readableByteStreamControllerCancel, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerCancelCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerErrorCode, readableByteStreamControllerError, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerErrorCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerCloseCode, readableByteStreamControllerClose, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerCloseCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCode, readableByteStreamControllerClearPendingPullIntos, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerClearPendingPullIntosCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCode, readableByteStreamControllerGetDesiredSize, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerGetDesiredSizeCodeLength) \ - macro(readableByteStreamInternalsReadableStreamHasBYOBReaderCode, readableStreamHasBYOBReader, ASCIILiteral(), s_readableByteStreamInternalsReadableStreamHasBYOBReaderCodeLength) \ - macro(readableByteStreamInternalsReadableStreamHasDefaultReaderCode, readableStreamHasDefaultReader, ASCIILiteral(), s_readableByteStreamInternalsReadableStreamHasDefaultReaderCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCode, readableByteStreamControllerHandleQueueDrain, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerHandleQueueDrainCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerPullCode, readableByteStreamControllerPull, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerPullCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCode, readableByteStreamControllerShouldCallPull, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerShouldCallPullCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCode, readableByteStreamControllerCallPullIfNeeded, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerCallPullIfNeededCodeLength) \ - macro(readableByteStreamInternalsTransferBufferToCurrentRealmCode, transferBufferToCurrentRealm, ASCIILiteral(), s_readableByteStreamInternalsTransferBufferToCurrentRealmCodeLength) \ - macro(readableByteStreamInternalsReadableStreamReaderKindCode, readableStreamReaderKind, ASCIILiteral(), s_readableByteStreamInternalsReadableStreamReaderKindCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerEnqueueCode, readableByteStreamControllerEnqueue, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerEnqueueCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCode, readableByteStreamControllerEnqueueChunk, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerEnqueueChunkCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCode, readableByteStreamControllerRespondWithNewView, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerRespondWithNewViewCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerRespondCode, readableByteStreamControllerRespond, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerRespondCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerRespondInternalCode, readableByteStreamControllerRespondInternal, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerRespondInternalCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCode, readableByteStreamControllerRespondInReadableState, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerRespondInReadableStateCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCode, readableByteStreamControllerRespondInClosedState, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerRespondInClosedStateCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCode, readableByteStreamControllerProcessPullDescriptors, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerProcessPullDescriptorsCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCode, readableByteStreamControllerFillDescriptorFromQueue, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerFillDescriptorFromQueueCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCode, readableByteStreamControllerShiftPendingDescriptor, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerShiftPendingDescriptorCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCode, readableByteStreamControllerInvalidateBYOBRequest, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerInvalidateBYOBRequestCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCode, readableByteStreamControllerCommitDescriptor, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerCommitDescriptorCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCode, readableByteStreamControllerConvertDescriptor, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerConvertDescriptorCodeLength) \ - macro(readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCode, readableStreamFulfillReadIntoRequest, ASCIILiteral(), s_readableByteStreamInternalsReadableStreamFulfillReadIntoRequestCodeLength) \ - macro(readableByteStreamInternalsReadableStreamBYOBReaderReadCode, readableStreamBYOBReaderRead, ASCIILiteral(), s_readableByteStreamInternalsReadableStreamBYOBReaderReadCodeLength) \ - macro(readableByteStreamInternalsReadableByteStreamControllerPullIntoCode, readableByteStreamControllerPullInto, ASCIILiteral(), s_readableByteStreamInternalsReadableByteStreamControllerPullIntoCodeLength) \ - macro(readableByteStreamInternalsReadableStreamAddReadIntoRequestCode, readableStreamAddReadIntoRequest, ASCIILiteral(), s_readableByteStreamInternalsReadableStreamAddReadIntoRequestCodeLength) \ - -#define WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(macro) \ - macro(isReadableByteStreamController) \ - macro(isReadableStreamBYOBReader) \ - macro(isReadableStreamBYOBRequest) \ - macro(privateInitializeReadableByteStreamController) \ - macro(privateInitializeReadableStreamBYOBRequest) \ - macro(readableByteStreamControllerCallPullIfNeeded) \ - macro(readableByteStreamControllerCancel) \ - macro(readableByteStreamControllerClearPendingPullIntos) \ - macro(readableByteStreamControllerClose) \ - macro(readableByteStreamControllerCommitDescriptor) \ - macro(readableByteStreamControllerConvertDescriptor) \ - macro(readableByteStreamControllerEnqueue) \ - macro(readableByteStreamControllerEnqueueChunk) \ - macro(readableByteStreamControllerError) \ - macro(readableByteStreamControllerFillDescriptorFromQueue) \ - macro(readableByteStreamControllerGetDesiredSize) \ - macro(readableByteStreamControllerHandleQueueDrain) \ - macro(readableByteStreamControllerInvalidateBYOBRequest) \ - macro(readableByteStreamControllerProcessPullDescriptors) \ - macro(readableByteStreamControllerPull) \ - macro(readableByteStreamControllerPullInto) \ - macro(readableByteStreamControllerRespond) \ - macro(readableByteStreamControllerRespondInClosedState) \ - macro(readableByteStreamControllerRespondInReadableState) \ - macro(readableByteStreamControllerRespondInternal) \ - macro(readableByteStreamControllerRespondWithNewView) \ - macro(readableByteStreamControllerShiftPendingDescriptor) \ - macro(readableByteStreamControllerShouldCallPull) \ - macro(readableStreamAddReadIntoRequest) \ - macro(readableStreamBYOBReaderRead) \ - macro(readableStreamByteStreamControllerStart) \ - macro(readableStreamFulfillReadIntoRequest) \ - macro(readableStreamHasBYOBReader) \ - macro(readableStreamHasDefaultReader) \ - macro(readableStreamReaderKind) \ - macro(transferBufferToCurrentRealm) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ReadableByteStreamInternalsBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ReadableByteStreamInternalsBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ReadableByteStreamInternalsBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ReadableByteStreamInternalsBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -class ReadableByteStreamInternalsBuiltinFunctions { -public: - explicit ReadableByteStreamInternalsBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { } - - void init(JSC::JSGlobalObject&); - template<typename Visitor> void visit(Visitor&); - -public: - JSC::VM& m_vm; - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \ - JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function; - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS -}; - -inline void ReadableByteStreamInternalsBuiltinFunctions::init(JSC::JSGlobalObject& globalObject) -{ -#define EXPORT_FUNCTION(codeName, functionName, overriddenName, length)\ - m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject)); - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_CODE(EXPORT_FUNCTION) -#undef EXPORT_FUNCTION -} - -template<typename Visitor> -inline void ReadableByteStreamInternalsBuiltinFunctions::visit(Visitor& visitor) -{ -#define VISIT_FUNCTION(name) visitor.append(m_##name##Function); - WEBCORE_FOREACH_READABLEBYTESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION) -#undef VISIT_FUNCTION -} - -template void ReadableByteStreamInternalsBuiltinFunctions::visit(JSC::AbstractSlotVisitor&); -template void ReadableByteStreamInternalsBuiltinFunctions::visit(JSC::SlotVisitor&); - - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ReadableStreamBYOBReaderBuiltins.cpp b/src/bun.js/builtins/cpp/ReadableStreamBYOBReaderBuiltins.cpp deleted file mode 100644 index 04264fc40..000000000 --- a/src/bun.js/builtins/cpp/ReadableStreamBYOBReaderBuiltins.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "ReadableStreamBYOBReaderBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeLength = 585; -static const JSC::Intrinsic s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStream(stream))\n" \ - " @throwTypeError(\"ReadableStreamBYOBReader needs a ReadableStream\");\n" \ - " if (!@isReadableByteStreamController(@getByIdDirectPrivate(stream, \"readableStreamController\")))\n" \ - " @throwTypeError(\"ReadableStreamBYOBReader needs a ReadableByteStreamController\");\n" \ - " if (@isReadableStreamLocked(stream))\n" \ - " @throwTypeError(\"ReadableStream is locked\");\n" \ - "\n" \ - " @readableStreamReaderGenericInitialize(this, stream);\n" \ - " @putByIdDirectPrivate(this, \"readIntoRequests\", @createFIFO());\n" \ - "\n" \ - " return this;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamBYOBReaderCancelCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamBYOBReaderCancelCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamBYOBReaderCancelCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamBYOBReaderCancelCodeLength = 410; -static const JSC::Intrinsic s_readableStreamBYOBReaderCancelCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamBYOBReaderCancelCode = - "(function (reason)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStreamBYOBReader(this))\n" \ - " return @Promise.@reject(@makeThisTypeError(\"ReadableStreamBYOBReader\", \"cancel\"));\n" \ - "\n" \ - " if (!@getByIdDirectPrivate(this, \"ownerReadableStream\"))\n" \ - " return @Promise.@reject(@makeTypeError(\"cancel() called on a reader owned by no readable stream\"));\n" \ - "\n" \ - " return @readableStreamReaderGenericCancel(this, reason);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamBYOBReaderReadCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamBYOBReaderReadCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamBYOBReaderReadCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamBYOBReaderReadCodeLength = 762; -static const JSC::Intrinsic s_readableStreamBYOBReaderReadCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamBYOBReaderReadCode = - "(function (view)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStreamBYOBReader(this))\n" \ - " return @Promise.@reject(@makeThisTypeError(\"ReadableStreamBYOBReader\", \"read\"));\n" \ - "\n" \ - " if (!@getByIdDirectPrivate(this, \"ownerReadableStream\"))\n" \ - " return @Promise.@reject(@makeTypeError(\"read() called on a reader owned by no readable stream\"));\n" \ - "\n" \ - " if (!@isObject(view))\n" \ - " return @Promise.@reject(@makeTypeError(\"Provided view is not an object\"));\n" \ - "\n" \ - " if (!@ArrayBuffer.@isView(view))\n" \ - " return @Promise.@reject(@makeTypeError(\"Provided view is not an ArrayBufferView\"));\n" \ - "\n" \ - " if (view.byteLength === 0)\n" \ - " return @Promise.@reject(@makeTypeError(\"Provided view cannot have a 0 byteLength\"));\n" \ - "\n" \ - " return @readableStreamBYOBReaderRead(this, view);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamBYOBReaderReleaseLockCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamBYOBReaderReleaseLockCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamBYOBReaderReleaseLockCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamBYOBReaderReleaseLockCodeLength = 447; -static const JSC::Intrinsic s_readableStreamBYOBReaderReleaseLockCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamBYOBReaderReleaseLockCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStreamBYOBReader(this))\n" \ - " throw @makeThisTypeError(\"ReadableStreamBYOBReader\", \"releaseLock\");\n" \ - "\n" \ - " if (!@getByIdDirectPrivate(this, \"ownerReadableStream\"))\n" \ - " return;\n" \ - "\n" \ - " if (@getByIdDirectPrivate(this, \"readIntoRequests\")?.isNotEmpty())\n" \ - " @throwTypeError(\"There are still pending read requests, cannot release the lock\");\n" \ - "\n" \ - " @readableStreamReaderGenericRelease(this);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamBYOBReaderClosedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamBYOBReaderClosedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamBYOBReaderClosedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamBYOBReaderClosedCodeLength = 251; -static const JSC::Intrinsic s_readableStreamBYOBReaderClosedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamBYOBReaderClosedCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStreamBYOBReader(this))\n" \ - " return @Promise.@reject(@makeGetterTypeError(\"ReadableStreamBYOBReader\", \"closed\"));\n" \ - "\n" \ - " return @getByIdDirectPrivate(this, \"closedPromiseCapability\").@promise;\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().readableStreamBYOBReaderBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().readableStreamBYOBReaderBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ReadableStreamBYOBReaderBuiltins.h b/src/bun.js/builtins/cpp/ReadableStreamBYOBReaderBuiltins.h deleted file mode 100644 index 54f1985c7..000000000 --- a/src/bun.js/builtins/cpp/ReadableStreamBYOBReaderBuiltins.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* ReadableStreamBYOBReader */ -extern const char* const s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCode; -extern const int s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeLength; -extern const JSC::ConstructAbility s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeImplementationVisibility; -extern const char* const s_readableStreamBYOBReaderCancelCode; -extern const int s_readableStreamBYOBReaderCancelCodeLength; -extern const JSC::ConstructAbility s_readableStreamBYOBReaderCancelCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamBYOBReaderCancelCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamBYOBReaderCancelCodeImplementationVisibility; -extern const char* const s_readableStreamBYOBReaderReadCode; -extern const int s_readableStreamBYOBReaderReadCodeLength; -extern const JSC::ConstructAbility s_readableStreamBYOBReaderReadCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamBYOBReaderReadCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamBYOBReaderReadCodeImplementationVisibility; -extern const char* const s_readableStreamBYOBReaderReleaseLockCode; -extern const int s_readableStreamBYOBReaderReleaseLockCodeLength; -extern const JSC::ConstructAbility s_readableStreamBYOBReaderReleaseLockCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamBYOBReaderReleaseLockCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamBYOBReaderReleaseLockCodeImplementationVisibility; -extern const char* const s_readableStreamBYOBReaderClosedCode; -extern const int s_readableStreamBYOBReaderClosedCodeLength; -extern const JSC::ConstructAbility s_readableStreamBYOBReaderClosedCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamBYOBReaderClosedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamBYOBReaderClosedCodeImplementationVisibility; - -#define WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_DATA(macro) \ - macro(initializeReadableStreamBYOBReader, readableStreamBYOBReaderInitializeReadableStreamBYOBReader, 1) \ - macro(cancel, readableStreamBYOBReaderCancel, 1) \ - macro(read, readableStreamBYOBReaderRead, 1) \ - macro(releaseLock, readableStreamBYOBReaderReleaseLock, 0) \ - macro(closed, readableStreamBYOBReaderClosed, 0) \ - -#define WEBCORE_BUILTIN_READABLESTREAMBYOBREADER_INITIALIZEREADABLESTREAMBYOBREADER 1 -#define WEBCORE_BUILTIN_READABLESTREAMBYOBREADER_CANCEL 1 -#define WEBCORE_BUILTIN_READABLESTREAMBYOBREADER_READ 1 -#define WEBCORE_BUILTIN_READABLESTREAMBYOBREADER_RELEASELOCK 1 -#define WEBCORE_BUILTIN_READABLESTREAMBYOBREADER_CLOSED 1 - -#define WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_CODE(macro) \ - macro(readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCode, initializeReadableStreamBYOBReader, ASCIILiteral(), s_readableStreamBYOBReaderInitializeReadableStreamBYOBReaderCodeLength) \ - macro(readableStreamBYOBReaderCancelCode, cancel, ASCIILiteral(), s_readableStreamBYOBReaderCancelCodeLength) \ - macro(readableStreamBYOBReaderReadCode, read, ASCIILiteral(), s_readableStreamBYOBReaderReadCodeLength) \ - macro(readableStreamBYOBReaderReleaseLockCode, releaseLock, ASCIILiteral(), s_readableStreamBYOBReaderReleaseLockCodeLength) \ - macro(readableStreamBYOBReaderClosedCode, closed, "get closed"_s, s_readableStreamBYOBReaderClosedCodeLength) \ - -#define WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_FUNCTION_NAME(macro) \ - macro(cancel) \ - macro(closed) \ - macro(initializeReadableStreamBYOBReader) \ - macro(read) \ - macro(releaseLock) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ReadableStreamBYOBReaderBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ReadableStreamBYOBReaderBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ReadableStreamBYOBReaderBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ReadableStreamBYOBReaderBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_READABLESTREAMBYOBREADER_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ReadableStreamBYOBRequestBuiltins.cpp b/src/bun.js/builtins/cpp/ReadableStreamBYOBRequestBuiltins.cpp deleted file mode 100644 index 7c67a3443..000000000 --- a/src/bun.js/builtins/cpp/ReadableStreamBYOBRequestBuiltins.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "ReadableStreamBYOBRequestBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeLength = 306; -static const JSC::Intrinsic s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCode = - "(function (controller, view)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (arguments.length !== 3 && arguments[2] !== @isReadableStream)\n" \ - " @throwTypeError(\"ReadableStreamBYOBRequest constructor should not be called directly\");\n" \ - "\n" \ - " return @privateInitializeReadableStreamBYOBRequest.@call(this, controller, view);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamBYOBRequestRespondCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamBYOBRequestRespondCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamBYOBRequestRespondCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamBYOBRequestRespondCodeLength = 504; -static const JSC::Intrinsic s_readableStreamBYOBRequestRespondCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamBYOBRequestRespondCode = - "(function (bytesWritten)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStreamBYOBRequest(this))\n" \ - " throw @makeThisTypeError(\"ReadableStreamBYOBRequest\", \"respond\");\n" \ - "\n" \ - " if (@getByIdDirectPrivate(this, \"associatedReadableByteStreamController\") === @undefined)\n" \ - " @throwTypeError(\"ReadableStreamBYOBRequest.associatedReadableByteStreamController is undefined\");\n" \ - "\n" \ - " return @readableByteStreamControllerRespond(@getByIdDirectPrivate(this, \"associatedReadableByteStreamController\"), bytesWritten);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamBYOBRequestRespondWithNewViewCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamBYOBRequestRespondWithNewViewCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamBYOBRequestRespondWithNewViewCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamBYOBRequestRespondWithNewViewCodeLength = 691; -static const JSC::Intrinsic s_readableStreamBYOBRequestRespondWithNewViewCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamBYOBRequestRespondWithNewViewCode = - "(function (view)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStreamBYOBRequest(this))\n" \ - " throw @makeThisTypeError(\"ReadableStreamBYOBRequest\", \"respond\");\n" \ - "\n" \ - " if (@getByIdDirectPrivate(this, \"associatedReadableByteStreamController\") === @undefined)\n" \ - " @throwTypeError(\"ReadableStreamBYOBRequest.associatedReadableByteStreamController is undefined\");\n" \ - "\n" \ - " if (!@isObject(view))\n" \ - " @throwTypeError(\"Provided view is not an object\");\n" \ - "\n" \ - " if (!@ArrayBuffer.@isView(view))\n" \ - " @throwTypeError(\"Provided view is not an ArrayBufferView\");\n" \ - "\n" \ - " return @readableByteStreamControllerRespondWithNewView(@getByIdDirectPrivate(this, \"associatedReadableByteStreamController\"), view);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamBYOBRequestViewCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamBYOBRequestViewCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamBYOBRequestViewCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamBYOBRequestViewCodeLength = 204; -static const JSC::Intrinsic s_readableStreamBYOBRequestViewCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamBYOBRequestViewCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStreamBYOBRequest(this))\n" \ - " throw @makeGetterTypeError(\"ReadableStreamBYOBRequest\", \"view\");\n" \ - "\n" \ - " return @getByIdDirectPrivate(this, \"view\");\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().readableStreamBYOBRequestBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().readableStreamBYOBRequestBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ReadableStreamBYOBRequestBuiltins.h b/src/bun.js/builtins/cpp/ReadableStreamBYOBRequestBuiltins.h deleted file mode 100644 index 497a17bb0..000000000 --- a/src/bun.js/builtins/cpp/ReadableStreamBYOBRequestBuiltins.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* ReadableStreamBYOBRequest */ -extern const char* const s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCode; -extern const int s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeLength; -extern const JSC::ConstructAbility s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeImplementationVisibility; -extern const char* const s_readableStreamBYOBRequestRespondCode; -extern const int s_readableStreamBYOBRequestRespondCodeLength; -extern const JSC::ConstructAbility s_readableStreamBYOBRequestRespondCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamBYOBRequestRespondCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamBYOBRequestRespondCodeImplementationVisibility; -extern const char* const s_readableStreamBYOBRequestRespondWithNewViewCode; -extern const int s_readableStreamBYOBRequestRespondWithNewViewCodeLength; -extern const JSC::ConstructAbility s_readableStreamBYOBRequestRespondWithNewViewCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamBYOBRequestRespondWithNewViewCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamBYOBRequestRespondWithNewViewCodeImplementationVisibility; -extern const char* const s_readableStreamBYOBRequestViewCode; -extern const int s_readableStreamBYOBRequestViewCodeLength; -extern const JSC::ConstructAbility s_readableStreamBYOBRequestViewCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamBYOBRequestViewCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamBYOBRequestViewCodeImplementationVisibility; - -#define WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_DATA(macro) \ - macro(initializeReadableStreamBYOBRequest, readableStreamBYOBRequestInitializeReadableStreamBYOBRequest, 2) \ - macro(respond, readableStreamBYOBRequestRespond, 1) \ - macro(respondWithNewView, readableStreamBYOBRequestRespondWithNewView, 1) \ - macro(view, readableStreamBYOBRequestView, 0) \ - -#define WEBCORE_BUILTIN_READABLESTREAMBYOBREQUEST_INITIALIZEREADABLESTREAMBYOBREQUEST 1 -#define WEBCORE_BUILTIN_READABLESTREAMBYOBREQUEST_RESPOND 1 -#define WEBCORE_BUILTIN_READABLESTREAMBYOBREQUEST_RESPONDWITHNEWVIEW 1 -#define WEBCORE_BUILTIN_READABLESTREAMBYOBREQUEST_VIEW 1 - -#define WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_CODE(macro) \ - macro(readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCode, initializeReadableStreamBYOBRequest, ASCIILiteral(), s_readableStreamBYOBRequestInitializeReadableStreamBYOBRequestCodeLength) \ - macro(readableStreamBYOBRequestRespondCode, respond, ASCIILiteral(), s_readableStreamBYOBRequestRespondCodeLength) \ - macro(readableStreamBYOBRequestRespondWithNewViewCode, respondWithNewView, ASCIILiteral(), s_readableStreamBYOBRequestRespondWithNewViewCodeLength) \ - macro(readableStreamBYOBRequestViewCode, view, "get view"_s, s_readableStreamBYOBRequestViewCodeLength) \ - -#define WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_FUNCTION_NAME(macro) \ - macro(initializeReadableStreamBYOBRequest) \ - macro(respond) \ - macro(respondWithNewView) \ - macro(view) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ReadableStreamBYOBRequestBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ReadableStreamBYOBRequestBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ReadableStreamBYOBRequestBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ReadableStreamBYOBRequestBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_READABLESTREAMBYOBREQUEST_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ReadableStreamBuiltins.cpp b/src/bun.js/builtins/cpp/ReadableStreamBuiltins.cpp deleted file mode 100644 index 21c099c56..000000000 --- a/src/bun.js/builtins/cpp/ReadableStreamBuiltins.cpp +++ /dev/null @@ -1,601 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "ReadableStreamBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_readableStreamInitializeReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInitializeReadableStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInitializeReadableStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInitializeReadableStreamCodeLength = 3256; -static const JSC::Intrinsic s_readableStreamInitializeReadableStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInitializeReadableStreamCode = - "(function (underlyingSource, strategy)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (underlyingSource === @undefined)\n" \ - " underlyingSource = { @bunNativeType: 0, @bunNativePtr: 0, @lazy: false };\n" \ - " if (strategy === @undefined)\n" \ - " strategy = { };\n" \ - "\n" \ - " if (!@isObject(underlyingSource))\n" \ - " @throwTypeError(\"ReadableStream constructor takes an object as first argument\");\n" \ - "\n" \ - " if (strategy !== @undefined && !@isObject(strategy))\n" \ - " @throwTypeError(\"ReadableStream constructor takes an object as second argument, if any\");\n" \ - "\n" \ - " @putByIdDirectPrivate(this, \"state\", @streamReadable);\n" \ - " \n" \ - " @putByIdDirectPrivate(this, \"reader\", @undefined);\n" \ - " \n" \ - " @putByIdDirectPrivate(this, \"storedError\", @undefined);\n" \ - " \n" \ - " @putByIdDirectPrivate(this, \"disturbed\", false);\n" \ - "\n" \ - " \n" \ - " //\n" \ - " @putByIdDirectPrivate(this, \"readableStreamController\", null);\n" \ - " @putByIdDirectPrivate(this, \"bunNativeType\", @getByIdDirectPrivate(underlyingSource, \"bunNativeType\") ?? 0);\n" \ - " @putByIdDirectPrivate(this, \"bunNativePtr\", @getByIdDirectPrivate(underlyingSource, \"bunNativePtr\") ?? 0);\n" \ - "\n" \ - " const isDirect = underlyingSource.type === \"direct\";\n" \ - " //\n" \ - " const isUnderlyingSourceLazy = !!underlyingSource.@lazy;\n" \ - " const isLazy = isDirect || isUnderlyingSourceLazy;\n" \ - " \n" \ - " //\n" \ - " //\n" \ - " if (@getByIdDirectPrivate(underlyingSource, \"pull\") !== @undefined && !isLazy) {\n" \ - " const size = @getByIdDirectPrivate(strategy, \"size\");\n" \ - " const highWaterMark = @getByIdDirectPrivate(strategy, \"highWaterMark\");\n" \ - " @putByIdDirectPrivate(this, \"highWaterMark\", highWaterMark);\n" \ - " @putByIdDirectPrivate(this, \"underlyingSource\", @undefined);\n" \ - " @setupReadableStreamDefaultController(this, underlyingSource, size, highWaterMark !== @undefined ? highWaterMark : 1, @getByIdDirectPrivate(underlyingSource, \"start\"), @getByIdDirectPrivate(underlyingSource, \"pull\"), @getByIdDirectPrivate(underlyingSource, \"cancel\"));\n" \ - " \n" \ - " return this;\n" \ - " }\n" \ - " if (isDirect) {\n" \ - " @putByIdDirectPrivate(this, \"underlyingSource\", underlyingSource);\n" \ - " @putByIdDirectPrivate(this, \"highWaterMark\", @getByIdDirectPrivate(strategy, \"highWaterMark\"));\n" \ - " @putByIdDirectPrivate(this, \"start\", () => @createReadableStreamController(this, underlyingSource, strategy));\n" \ - " } else if (isLazy) {\n" \ - " const autoAllocateChunkSize = underlyingSource.autoAllocateChunkSize;\n" \ - " @putByIdDirectPrivate(this, \"highWaterMark\", @undefined);\n" \ - " @putByIdDirectPrivate(this, \"underlyingSource\", @undefined);\n" \ - " @putByIdDirectPrivate(this, \"highWaterMark\", autoAllocateChunkSize || @getByIdDirectPrivate(strategy, \"highWaterMark\"));\n" \ - "\n" \ - " \n" \ - " @putByIdDirectPrivate(this, \"start\", () => {\n" \ - " const instance = @lazyLoadStream(this, autoAllocateChunkSize);\n" \ - " if (instance) {\n" \ - " @createReadableStreamController(this, instance, strategy);\n" \ - " }\n" \ - " });\n" \ - " } else {\n" \ - " @putByIdDirectPrivate(this, \"underlyingSource\", @undefined);\n" \ - " @putByIdDirectPrivate(this, \"highWaterMark\", @getByIdDirectPrivate(strategy, \"highWaterMark\"));\n" \ - " @putByIdDirectPrivate(this, \"start\", @undefined);\n" \ - " @createReadableStreamController(this, underlyingSource, strategy);\n" \ - " }\n" \ - " \n" \ - "\n" \ - " return this;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamReadableStreamToArrayCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamReadableStreamToArrayCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamReadableStreamToArrayCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamReadableStreamToArrayCodeLength = 294; -static const JSC::Intrinsic s_readableStreamReadableStreamToArrayCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamReadableStreamToArrayCode = - "(function (stream) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " //\n" \ - " var underlyingSource = @getByIdDirectPrivate(stream, \"underlyingSource\");\n" \ - " if (underlyingSource !== @undefined) {\n" \ - " return @readableStreamToArrayDirect(stream, underlyingSource);\n" \ - " }\n" \ - "\n" \ - " return @readableStreamIntoArray(stream);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamReadableStreamToTextCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamReadableStreamToTextCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamReadableStreamToTextCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamReadableStreamToTextCodeLength = 292; -static const JSC::Intrinsic s_readableStreamReadableStreamToTextCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamReadableStreamToTextCode = - "(function (stream) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " //\n" \ - " var underlyingSource = @getByIdDirectPrivate(stream, \"underlyingSource\");\n" \ - " if (underlyingSource !== @undefined) {\n" \ - " return @readableStreamToTextDirect(stream, underlyingSource);\n" \ - " }\n" \ - "\n" \ - " return @readableStreamIntoText(stream);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamReadableStreamToArrayBufferCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamReadableStreamToArrayBufferCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamReadableStreamToArrayBufferCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamReadableStreamToArrayBufferCodeLength = 334; -static const JSC::Intrinsic s_readableStreamReadableStreamToArrayBufferCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamReadableStreamToArrayBufferCode = - "(function (stream) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " //\n" \ - " var underlyingSource = @getByIdDirectPrivate(stream, \"underlyingSource\");\n" \ - "\n" \ - " if (underlyingSource !== @undefined) {\n" \ - " return @readableStreamToArrayBufferDirect(stream, underlyingSource);\n" \ - " }\n" \ - "\n" \ - " return @Bun.readableStreamToArray(stream).@then(@Bun.concatArrayBuffers);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamReadableStreamToJSONCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamReadableStreamToJSONCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamReadableStreamToJSONCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamReadableStreamToJSONCodeLength = 118; -static const JSC::Intrinsic s_readableStreamReadableStreamToJSONCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamReadableStreamToJSONCode = - "(function (stream) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " return @Bun.readableStreamToText(stream).@then(globalThis.JSON.parse);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamReadableStreamToBlobCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamReadableStreamToBlobCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamReadableStreamToBlobCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamReadableStreamToBlobCodeLength = 139; -static const JSC::Intrinsic s_readableStreamReadableStreamToBlobCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamReadableStreamToBlobCode = - "(function (stream) {\n" \ - " \"use strict\";\n" \ - " return @Promise.resolve(@Bun.readableStreamToArray(stream)).@then(array => new Blob(array));\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamConsumeReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamConsumeReadableStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamConsumeReadableStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamConsumeReadableStreamCodeLength = 3736; -static const JSC::Intrinsic s_readableStreamConsumeReadableStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamConsumeReadableStreamCode = - "(function (nativePtr, nativeType, inputStream) {\n" \ - " \"use strict\";\n" \ - " const symbol = globalThis.Symbol.for(\"Bun.consumeReadableStreamPrototype\");\n" \ - " var cached = globalThis[symbol];\n" \ - " if (!cached) {\n" \ - " cached = globalThis[symbol] = [];\n" \ - " }\n" \ - " var Prototype = cached[nativeType];\n" \ - " if (Prototype === @undefined) {\n" \ - " var [doRead, doError, doReadMany, doClose, onClose, deinit] = globalThis[globalThis.Symbol.for(\"Bun.lazy\")](nativeType);\n" \ - "\n" \ - " Prototype = class NativeReadableStreamSink {\n" \ - " constructor(reader, ptr) {\n" \ - " this.#ptr = ptr;\n" \ - " this.#reader = reader;\n" \ - " this.#didClose = false;\n" \ - "\n" \ - " this.handleError = this._handleError.bind(this);\n" \ - " this.handleClosed = this._handleClosed.bind(this);\n" \ - " this.processResult = this._processResult.bind(this);\n" \ - "\n" \ - " reader.closed.then(this.handleClosed, this.handleError);\n" \ - " }\n" \ - "\n" \ - " handleError;\n" \ - " handleClosed;\n" \ - " _handleClosed() {\n" \ - " if (this.#didClose) return;\n" \ - " this.#didClose = true;\n" \ - " var ptr = this.#ptr;\n" \ - " this.#ptr = 0;\n" \ - " doClose(ptr);\n" \ - " deinit(ptr);\n" \ - " }\n" \ - "\n" \ - " _handleError(error) {\n" \ - " if (this.#didClose) return;\n" \ - " this.#didClose = true;\n" \ - " var ptr = this.#ptr;\n" \ - " this.#ptr = 0;\n" \ - " doError(ptr, error);\n" \ - " deinit(ptr);\n" \ - " }\n" \ - "\n" \ - " #ptr;\n" \ - " #didClose = false;\n" \ - " #reader;\n" \ - "\n" \ - " _handleReadMany({value, done, size}) {\n" \ - " if (done) {\n" \ - " this.handleClosed();\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " if (this.#didClose) return;\n" \ - " \n" \ - "\n" \ - " doReadMany(this.#ptr, value, done, size);\n" \ - " }\n" \ - " \n" \ - "\n" \ - " read() {\n" \ - " if (!this.#ptr) return @throwTypeError(\"ReadableStreamSink is already closed\");\n" \ - " \n" \ - " return this.processResult(this.#reader.read());\n" \ - " \n" \ - " }\n" \ - "\n" \ - " _processResult(result) {\n" \ - " if (result && @isPromise(result)) {\n" \ - " const flags = @getPromiseInternalField(result, @promiseFieldFlags);\n" \ - " if (flags & @promiseStateFulfilled) {\n" \ - " const fulfilledValue = @getPromiseInternalField(result, @promiseFieldReactionsOrResult);\n" \ - " if (fulfilledValue) {\n" \ - " result = fulfilledValue;\n" \ - " }\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " if (result && @isPromise(result)) {\n" \ - " result.then(this.processResult, this.handleError);\n" \ - " return null;\n" \ - " }\n" \ - "\n" \ - " if (result.done) {\n" \ - " this.handleClosed();\n" \ - " return 0;\n" \ - " } else if (result.value) {\n" \ - " return result.value;\n" \ - " } else {\n" \ - " return -1;\n" \ - " }\n" \ - "\n" \ - " \n" \ - " }\n" \ - "\n" \ - " readMany() {\n" \ - " if (!this.#ptr) return @throwTypeError(\"ReadableStreamSink is already closed\");\n" \ - " return this.processResult(this.#reader.readMany());\n" \ - " }\n" \ - "\n" \ - " \n" \ - " };\n" \ - "\n" \ - " const minlength = nativeType + 1;\n" \ - " if (cached.length < minlength) {\n" \ - " cached.length = minlength;\n" \ - " }\n" \ - " @putByValDirect(cached, nativeType, Prototype);\n" \ - " }\n" \ - "\n" \ - " if (@isReadableStreamLocked(inputStream)) {\n" \ - " @throwTypeError(\"Cannot start reading from a locked stream\");\n" \ - " }\n" \ - "\n" \ - " return new Prototype(inputStream.getReader(), nativePtr);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamCreateEmptyReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamCreateEmptyReadableStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamCreateEmptyReadableStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamCreateEmptyReadableStreamCodeLength = 156; -static const JSC::Intrinsic s_readableStreamCreateEmptyReadableStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamCreateEmptyReadableStreamCode = - "(function () {\n" \ - " \"use strict\";\n" \ - "\n" \ - " var stream = new @ReadableStream({\n" \ - " pull() {},\n" \ - " });\n" \ - " @readableStreamClose(stream);\n" \ - " return stream;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamCreateNativeReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamCreateNativeReadableStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamCreateNativeReadableStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamCreateNativeReadableStreamCodeLength = 266; -static const JSC::Intrinsic s_readableStreamCreateNativeReadableStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamCreateNativeReadableStreamCode = - "(function (nativePtr, nativeType, autoAllocateChunkSize) {\n" \ - " \"use strict\";\n" \ - " return new @ReadableStream({\n" \ - " @lazy: true,\n" \ - " @bunNativeType: nativeType,\n" \ - " @bunNativePtr: nativePtr,\n" \ - " autoAllocateChunkSize: autoAllocateChunkSize,\n" \ - " });\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamCancelCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamCancelCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamCancelCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamCancelCodeLength = 324; -static const JSC::Intrinsic s_readableStreamCancelCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamCancelCode = - "(function (reason)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStream(this))\n" \ - " return @Promise.@reject(@makeThisTypeError(\"ReadableStream\", \"cancel\"));\n" \ - "\n" \ - " if (@isReadableStreamLocked(this))\n" \ - " return @Promise.@reject(@makeTypeError(\"ReadableStream is locked\"));\n" \ - "\n" \ - " return @readableStreamCancel(this, reason);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamGetReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamGetReaderCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamGetReaderCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamGetReaderCodeLength = 680; -static const JSC::Intrinsic s_readableStreamGetReaderCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamGetReaderCode = - "(function (options)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStream(this))\n" \ - " throw @makeThisTypeError(\"ReadableStream\", \"getReader\");\n" \ - "\n" \ - " const mode = @toDictionary(options, { }, \"ReadableStream.getReader takes an object as first argument\").mode;\n" \ - " if (mode === @undefined) {\n" \ - " var start_ = @getByIdDirectPrivate(this, \"start\");\n" \ - " if (start_) {\n" \ - " @putByIdDirectPrivate(this, \"start\", @undefined);\n" \ - " start_();\n" \ - " }\n" \ - " \n" \ - " return new @ReadableStreamDefaultReader(this);\n" \ - " }\n" \ - " //\n" \ - " if (mode == 'byob') {\n" \ - " return new @ReadableStreamBYOBReader(this);\n" \ - " }\n" \ - "\n" \ - " \n" \ - " @throwTypeError(\"Invalid mode is specified\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamPipeThroughCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamPipeThroughCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamPipeThroughCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamPipeThroughCodeLength = 1485; -static const JSC::Intrinsic s_readableStreamPipeThroughCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamPipeThroughCode = - "(function (streams, options)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const transforms = streams;\n" \ - "\n" \ - " const readable = transforms[\"readable\"];\n" \ - " if (!@isReadableStream(readable))\n" \ - " throw @makeTypeError(\"readable should be ReadableStream\");\n" \ - "\n" \ - " const writable = transforms[\"writable\"];\n" \ - " const internalWritable = @getInternalWritableStream(writable);\n" \ - " if (!@isWritableStream(internalWritable))\n" \ - " throw @makeTypeError(\"writable should be WritableStream\");\n" \ - "\n" \ - " let preventClose = false;\n" \ - " let preventAbort = false;\n" \ - " let preventCancel = false;\n" \ - " let signal;\n" \ - " if (!@isUndefinedOrNull(options)) {\n" \ - " if (!@isObject(options))\n" \ - " throw @makeTypeError(\"options must be an object\");\n" \ - "\n" \ - " preventAbort = !!options[\"preventAbort\"];\n" \ - " preventCancel = !!options[\"preventCancel\"];\n" \ - " preventClose = !!options[\"preventClose\"];\n" \ - "\n" \ - " signal = options[\"signal\"];\n" \ - " if (signal !== @undefined && !@isAbortSignal(signal))\n" \ - " throw @makeTypeError(\"options.signal must be AbortSignal\");\n" \ - " }\n" \ - "\n" \ - " if (!@isReadableStream(this))\n" \ - " throw @makeThisTypeError(\"ReadableStream\", \"pipeThrough\");\n" \ - "\n" \ - " if (@isReadableStreamLocked(this))\n" \ - " throw @makeTypeError(\"ReadableStream is locked\");\n" \ - "\n" \ - " if (@isWritableStreamLocked(internalWritable))\n" \ - " throw @makeTypeError(\"WritableStream is locked\");\n" \ - "\n" \ - " @readableStreamPipeToWritableStream(this, internalWritable, preventClose, preventAbort, preventCancel, signal);\n" \ - "\n" \ - " return readable;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamPipeToCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamPipeToCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamPipeToCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamPipeToCodeLength = 1522; -static const JSC::Intrinsic s_readableStreamPipeToCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamPipeToCode = - "(function (destination)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " if (!@isReadableStream(this))\n" \ - " return @Promise.@reject(@makeThisTypeError(\"ReadableStream\", \"pipeTo\"));\n" \ - "\n" \ - " if (@isReadableStreamLocked(this))\n" \ - " return @Promise.@reject(@makeTypeError(\"ReadableStream is locked\"));\n" \ - "\n" \ - " //\n" \ - " //\n" \ - " let options = @argument(1);\n" \ - "\n" \ - " let preventClose = false;\n" \ - " let preventAbort = false;\n" \ - " let preventCancel = false;\n" \ - " let signal;\n" \ - " if (!@isUndefinedOrNull(options)) {\n" \ - " if (!@isObject(options))\n" \ - " return @Promise.@reject(@makeTypeError(\"options must be an object\"));\n" \ - "\n" \ - " try {\n" \ - " preventAbort = !!options[\"preventAbort\"];\n" \ - " preventCancel = !!options[\"preventCancel\"];\n" \ - " preventClose = !!options[\"preventClose\"];\n" \ - "\n" \ - " signal = options[\"signal\"];\n" \ - " } catch(e) {\n" \ - " return @Promise.@reject(e);\n" \ - " }\n" \ - "\n" \ - " if (signal !== @undefined && !@isAbortSignal(signal))\n" \ - " return @Promise.@reject(@makeTypeError(\"options.signal must be AbortSignal\"));\n" \ - " }\n" \ - "\n" \ - " const internalDestination = @getInternalWritableStream(destination);\n" \ - " if (!@isWritableStream(internalDestination))\n" \ - " return @Promise.@reject(@makeTypeError(\"ReadableStream pipeTo requires a WritableStream\"));\n" \ - "\n" \ - " if (@isWritableStreamLocked(internalDestination))\n" \ - " return @Promise.@reject(@makeTypeError(\"WritableStream is locked\"));\n" \ - "\n" \ - " return @readableStreamPipeToWritableStream(this, internalDestination, preventClose, preventAbort, preventCancel, signal);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamTeeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamTeeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamTeeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamTeeCodeLength = 175; -static const JSC::Intrinsic s_readableStreamTeeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamTeeCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStream(this))\n" \ - " throw @makeThisTypeError(\"ReadableStream\", \"tee\");\n" \ - "\n" \ - " return @readableStreamTee(this, false);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamLockedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamLockedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamLockedCodeLength = 178; -static const JSC::Intrinsic s_readableStreamLockedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamLockedCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStream(this))\n" \ - " throw @makeGetterTypeError(\"ReadableStream\", \"locked\");\n" \ - "\n" \ - " return @isReadableStreamLocked(this);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamValuesCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamValuesCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamValuesCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamValuesCodeLength = 191; -static const JSC::Intrinsic s_readableStreamValuesCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamValuesCode = - "(function (options) {\n" \ - " \"use strict\";\n" \ - " var prototype = @ReadableStream.prototype;\n" \ - " @readableStreamDefineLazyIterators(prototype);\n" \ - " return prototype.values.@call(this, options);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamLazyAsyncIteratorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamLazyAsyncIteratorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamLazyAsyncIteratorCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_readableStreamLazyAsyncIteratorCodeLength = 201; -static const JSC::Intrinsic s_readableStreamLazyAsyncIteratorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamLazyAsyncIteratorCode = - "(function () {\n" \ - " \"use strict\";\n" \ - " var prototype = @ReadableStream.prototype;\n" \ - " @readableStreamDefineLazyIterators(prototype);\n" \ - " return prototype[globalThis.Symbol.asyncIterator].@call(this);\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().readableStreamBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().readableStreamBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_READABLESTREAM_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ReadableStreamBuiltins.h b/src/bun.js/builtins/cpp/ReadableStreamBuiltins.h deleted file mode 100644 index 47ebda954..000000000 --- a/src/bun.js/builtins/cpp/ReadableStreamBuiltins.h +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* ReadableStream */ -extern const char* const s_readableStreamInitializeReadableStreamCode; -extern const int s_readableStreamInitializeReadableStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInitializeReadableStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInitializeReadableStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInitializeReadableStreamCodeImplementationVisibility; -extern const char* const s_readableStreamReadableStreamToArrayCode; -extern const int s_readableStreamReadableStreamToArrayCodeLength; -extern const JSC::ConstructAbility s_readableStreamReadableStreamToArrayCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamReadableStreamToArrayCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamReadableStreamToArrayCodeImplementationVisibility; -extern const char* const s_readableStreamReadableStreamToTextCode; -extern const int s_readableStreamReadableStreamToTextCodeLength; -extern const JSC::ConstructAbility s_readableStreamReadableStreamToTextCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamReadableStreamToTextCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamReadableStreamToTextCodeImplementationVisibility; -extern const char* const s_readableStreamReadableStreamToArrayBufferCode; -extern const int s_readableStreamReadableStreamToArrayBufferCodeLength; -extern const JSC::ConstructAbility s_readableStreamReadableStreamToArrayBufferCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamReadableStreamToArrayBufferCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamReadableStreamToArrayBufferCodeImplementationVisibility; -extern const char* const s_readableStreamReadableStreamToJSONCode; -extern const int s_readableStreamReadableStreamToJSONCodeLength; -extern const JSC::ConstructAbility s_readableStreamReadableStreamToJSONCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamReadableStreamToJSONCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamReadableStreamToJSONCodeImplementationVisibility; -extern const char* const s_readableStreamReadableStreamToBlobCode; -extern const int s_readableStreamReadableStreamToBlobCodeLength; -extern const JSC::ConstructAbility s_readableStreamReadableStreamToBlobCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamReadableStreamToBlobCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamReadableStreamToBlobCodeImplementationVisibility; -extern const char* const s_readableStreamConsumeReadableStreamCode; -extern const int s_readableStreamConsumeReadableStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamConsumeReadableStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamConsumeReadableStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamConsumeReadableStreamCodeImplementationVisibility; -extern const char* const s_readableStreamCreateEmptyReadableStreamCode; -extern const int s_readableStreamCreateEmptyReadableStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamCreateEmptyReadableStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamCreateEmptyReadableStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamCreateEmptyReadableStreamCodeImplementationVisibility; -extern const char* const s_readableStreamCreateNativeReadableStreamCode; -extern const int s_readableStreamCreateNativeReadableStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamCreateNativeReadableStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamCreateNativeReadableStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamCreateNativeReadableStreamCodeImplementationVisibility; -extern const char* const s_readableStreamCancelCode; -extern const int s_readableStreamCancelCodeLength; -extern const JSC::ConstructAbility s_readableStreamCancelCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamCancelCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamCancelCodeImplementationVisibility; -extern const char* const s_readableStreamGetReaderCode; -extern const int s_readableStreamGetReaderCodeLength; -extern const JSC::ConstructAbility s_readableStreamGetReaderCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamGetReaderCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamGetReaderCodeImplementationVisibility; -extern const char* const s_readableStreamPipeThroughCode; -extern const int s_readableStreamPipeThroughCodeLength; -extern const JSC::ConstructAbility s_readableStreamPipeThroughCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamPipeThroughCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamPipeThroughCodeImplementationVisibility; -extern const char* const s_readableStreamPipeToCode; -extern const int s_readableStreamPipeToCodeLength; -extern const JSC::ConstructAbility s_readableStreamPipeToCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamPipeToCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamPipeToCodeImplementationVisibility; -extern const char* const s_readableStreamTeeCode; -extern const int s_readableStreamTeeCodeLength; -extern const JSC::ConstructAbility s_readableStreamTeeCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamTeeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamTeeCodeImplementationVisibility; -extern const char* const s_readableStreamLockedCode; -extern const int s_readableStreamLockedCodeLength; -extern const JSC::ConstructAbility s_readableStreamLockedCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamLockedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamLockedCodeImplementationVisibility; -extern const char* const s_readableStreamValuesCode; -extern const int s_readableStreamValuesCodeLength; -extern const JSC::ConstructAbility s_readableStreamValuesCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamValuesCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamValuesCodeImplementationVisibility; -extern const char* const s_readableStreamLazyAsyncIteratorCode; -extern const int s_readableStreamLazyAsyncIteratorCodeLength; -extern const JSC::ConstructAbility s_readableStreamLazyAsyncIteratorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamLazyAsyncIteratorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamLazyAsyncIteratorCodeImplementationVisibility; - -#define WEBCORE_FOREACH_READABLESTREAM_BUILTIN_DATA(macro) \ - macro(initializeReadableStream, readableStreamInitializeReadableStream, 2) \ - macro(readableStreamToArray, readableStreamReadableStreamToArray, 1) \ - macro(readableStreamToText, readableStreamReadableStreamToText, 1) \ - macro(readableStreamToArrayBuffer, readableStreamReadableStreamToArrayBuffer, 1) \ - macro(readableStreamToJSON, readableStreamReadableStreamToJSON, 1) \ - macro(readableStreamToBlob, readableStreamReadableStreamToBlob, 1) \ - macro(consumeReadableStream, readableStreamConsumeReadableStream, 3) \ - macro(createEmptyReadableStream, readableStreamCreateEmptyReadableStream, 0) \ - macro(createNativeReadableStream, readableStreamCreateNativeReadableStream, 3) \ - macro(cancel, readableStreamCancel, 1) \ - macro(getReader, readableStreamGetReader, 1) \ - macro(pipeThrough, readableStreamPipeThrough, 2) \ - macro(pipeTo, readableStreamPipeTo, 1) \ - macro(tee, readableStreamTee, 0) \ - macro(locked, readableStreamLocked, 0) \ - macro(values, readableStreamValues, 1) \ - macro(lazyAsyncIterator, readableStreamLazyAsyncIterator, 0) \ - -#define WEBCORE_BUILTIN_READABLESTREAM_INITIALIZEREADABLESTREAM 1 -#define WEBCORE_BUILTIN_READABLESTREAM_READABLESTREAMTOARRAY 1 -#define WEBCORE_BUILTIN_READABLESTREAM_READABLESTREAMTOTEXT 1 -#define WEBCORE_BUILTIN_READABLESTREAM_READABLESTREAMTOARRAYBUFFER 1 -#define WEBCORE_BUILTIN_READABLESTREAM_READABLESTREAMTOJSON 1 -#define WEBCORE_BUILTIN_READABLESTREAM_READABLESTREAMTOBLOB 1 -#define WEBCORE_BUILTIN_READABLESTREAM_CONSUMEREADABLESTREAM 1 -#define WEBCORE_BUILTIN_READABLESTREAM_CREATEEMPTYREADABLESTREAM 1 -#define WEBCORE_BUILTIN_READABLESTREAM_CREATENATIVEREADABLESTREAM 1 -#define WEBCORE_BUILTIN_READABLESTREAM_CANCEL 1 -#define WEBCORE_BUILTIN_READABLESTREAM_GETREADER 1 -#define WEBCORE_BUILTIN_READABLESTREAM_PIPETHROUGH 1 -#define WEBCORE_BUILTIN_READABLESTREAM_PIPETO 1 -#define WEBCORE_BUILTIN_READABLESTREAM_TEE 1 -#define WEBCORE_BUILTIN_READABLESTREAM_LOCKED 1 -#define WEBCORE_BUILTIN_READABLESTREAM_VALUES 1 -#define WEBCORE_BUILTIN_READABLESTREAM_LAZYASYNCITERATOR 1 - -#define WEBCORE_FOREACH_READABLESTREAM_BUILTIN_CODE(macro) \ - macro(readableStreamInitializeReadableStreamCode, initializeReadableStream, ASCIILiteral(), s_readableStreamInitializeReadableStreamCodeLength) \ - macro(readableStreamReadableStreamToArrayCode, readableStreamToArray, ASCIILiteral(), s_readableStreamReadableStreamToArrayCodeLength) \ - macro(readableStreamReadableStreamToTextCode, readableStreamToText, ASCIILiteral(), s_readableStreamReadableStreamToTextCodeLength) \ - macro(readableStreamReadableStreamToArrayBufferCode, readableStreamToArrayBuffer, ASCIILiteral(), s_readableStreamReadableStreamToArrayBufferCodeLength) \ - macro(readableStreamReadableStreamToJSONCode, readableStreamToJSON, ASCIILiteral(), s_readableStreamReadableStreamToJSONCodeLength) \ - macro(readableStreamReadableStreamToBlobCode, readableStreamToBlob, ASCIILiteral(), s_readableStreamReadableStreamToBlobCodeLength) \ - macro(readableStreamConsumeReadableStreamCode, consumeReadableStream, ASCIILiteral(), s_readableStreamConsumeReadableStreamCodeLength) \ - macro(readableStreamCreateEmptyReadableStreamCode, createEmptyReadableStream, ASCIILiteral(), s_readableStreamCreateEmptyReadableStreamCodeLength) \ - macro(readableStreamCreateNativeReadableStreamCode, createNativeReadableStream, ASCIILiteral(), s_readableStreamCreateNativeReadableStreamCodeLength) \ - macro(readableStreamCancelCode, cancel, ASCIILiteral(), s_readableStreamCancelCodeLength) \ - macro(readableStreamGetReaderCode, getReader, ASCIILiteral(), s_readableStreamGetReaderCodeLength) \ - macro(readableStreamPipeThroughCode, pipeThrough, ASCIILiteral(), s_readableStreamPipeThroughCodeLength) \ - macro(readableStreamPipeToCode, pipeTo, ASCIILiteral(), s_readableStreamPipeToCodeLength) \ - macro(readableStreamTeeCode, tee, ASCIILiteral(), s_readableStreamTeeCodeLength) \ - macro(readableStreamLockedCode, locked, "get locked"_s, s_readableStreamLockedCodeLength) \ - macro(readableStreamValuesCode, values, ASCIILiteral(), s_readableStreamValuesCodeLength) \ - macro(readableStreamLazyAsyncIteratorCode, lazyAsyncIterator, ASCIILiteral(), s_readableStreamLazyAsyncIteratorCodeLength) \ - -#define WEBCORE_FOREACH_READABLESTREAM_BUILTIN_FUNCTION_NAME(macro) \ - macro(cancel) \ - macro(consumeReadableStream) \ - macro(createEmptyReadableStream) \ - macro(createNativeReadableStream) \ - macro(getReader) \ - macro(initializeReadableStream) \ - macro(lazyAsyncIterator) \ - macro(locked) \ - macro(pipeThrough) \ - macro(pipeTo) \ - macro(readableStreamToArray) \ - macro(readableStreamToArrayBuffer) \ - macro(readableStreamToBlob) \ - macro(readableStreamToJSON) \ - macro(readableStreamToText) \ - macro(tee) \ - macro(values) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_READABLESTREAM_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ReadableStreamBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ReadableStreamBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_READABLESTREAM_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_READABLESTREAM_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_READABLESTREAM_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_READABLESTREAM_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_READABLESTREAM_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_READABLESTREAM_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ReadableStreamBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_READABLESTREAM_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ReadableStreamBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_READABLESTREAM_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ReadableStreamDefaultControllerBuiltins.cpp b/src/bun.js/builtins/cpp/ReadableStreamDefaultControllerBuiltins.cpp deleted file mode 100644 index 8719e4cc1..000000000 --- a/src/bun.js/builtins/cpp/ReadableStreamDefaultControllerBuiltins.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "ReadableStreamDefaultControllerBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeLength = 376; -static const JSC::Intrinsic s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCode = - "(function (stream, underlyingSource, size, highWaterMark)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (arguments.length !== 5 && arguments[4] !== @isReadableStream)\n" \ - " @throwTypeError(\"ReadableStreamDefaultController constructor should not be called directly\");\n" \ - "\n" \ - " return @privateInitializeReadableStreamDefaultController.@call(this, stream, underlyingSource, size, highWaterMark);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamDefaultControllerEnqueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultControllerEnqueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultControllerEnqueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultControllerEnqueueCodeLength = 412; -static const JSC::Intrinsic s_readableStreamDefaultControllerEnqueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultControllerEnqueueCode = - "(function (chunk)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStreamDefaultController(this))\n" \ - " throw @makeThisTypeError(\"ReadableStreamDefaultController\", \"enqueue\");\n" \ - "\n" \ - " if (!@readableStreamDefaultControllerCanCloseOrEnqueue(this))\n" \ - " @throwTypeError(\"ReadableStreamDefaultController is not in a state where chunk can be enqueued\");\n" \ - "\n" \ - " return @readableStreamDefaultControllerEnqueue(this, chunk);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamDefaultControllerErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultControllerErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultControllerErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultControllerErrorCodeLength = 228; -static const JSC::Intrinsic s_readableStreamDefaultControllerErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultControllerErrorCode = - "(function (error)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStreamDefaultController(this))\n" \ - " throw @makeThisTypeError(\"ReadableStreamDefaultController\", \"error\");\n" \ - "\n" \ - " @readableStreamDefaultControllerError(this, error);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamDefaultControllerCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultControllerCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultControllerCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultControllerCloseCodeLength = 384; -static const JSC::Intrinsic s_readableStreamDefaultControllerCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultControllerCloseCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStreamDefaultController(this))\n" \ - " throw @makeThisTypeError(\"ReadableStreamDefaultController\", \"close\");\n" \ - "\n" \ - " if (!@readableStreamDefaultControllerCanCloseOrEnqueue(this))\n" \ - " @throwTypeError(\"ReadableStreamDefaultController is not in a state where it can be closed\");\n" \ - "\n" \ - " @readableStreamDefaultControllerClose(this);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamDefaultControllerDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultControllerDesiredSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultControllerDesiredSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultControllerDesiredSizeCodeLength = 240; -static const JSC::Intrinsic s_readableStreamDefaultControllerDesiredSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultControllerDesiredSizeCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStreamDefaultController(this))\n" \ - " throw @makeGetterTypeError(\"ReadableStreamDefaultController\", \"desiredSize\");\n" \ - "\n" \ - " return @readableStreamDefaultControllerGetDesiredSize(this);\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().readableStreamDefaultControllerBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().readableStreamDefaultControllerBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ReadableStreamDefaultControllerBuiltins.h b/src/bun.js/builtins/cpp/ReadableStreamDefaultControllerBuiltins.h deleted file mode 100644 index 3925f5fb9..000000000 --- a/src/bun.js/builtins/cpp/ReadableStreamDefaultControllerBuiltins.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* ReadableStreamDefaultController */ -extern const char* const s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCode; -extern const int s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeImplementationVisibility; -extern const char* const s_readableStreamDefaultControllerEnqueueCode; -extern const int s_readableStreamDefaultControllerEnqueueCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultControllerEnqueueCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultControllerEnqueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultControllerEnqueueCodeImplementationVisibility; -extern const char* const s_readableStreamDefaultControllerErrorCode; -extern const int s_readableStreamDefaultControllerErrorCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultControllerErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultControllerErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultControllerErrorCodeImplementationVisibility; -extern const char* const s_readableStreamDefaultControllerCloseCode; -extern const int s_readableStreamDefaultControllerCloseCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultControllerCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultControllerCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultControllerCloseCodeImplementationVisibility; -extern const char* const s_readableStreamDefaultControllerDesiredSizeCode; -extern const int s_readableStreamDefaultControllerDesiredSizeCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultControllerDesiredSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultControllerDesiredSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultControllerDesiredSizeCodeImplementationVisibility; - -#define WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_DATA(macro) \ - macro(initializeReadableStreamDefaultController, readableStreamDefaultControllerInitializeReadableStreamDefaultController, 4) \ - macro(enqueue, readableStreamDefaultControllerEnqueue, 1) \ - macro(error, readableStreamDefaultControllerError, 1) \ - macro(close, readableStreamDefaultControllerClose, 0) \ - macro(desiredSize, readableStreamDefaultControllerDesiredSize, 0) \ - -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTCONTROLLER_INITIALIZEREADABLESTREAMDEFAULTCONTROLLER 1 -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTCONTROLLER_ENQUEUE 1 -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTCONTROLLER_ERROR 1 -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTCONTROLLER_CLOSE 1 -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTCONTROLLER_DESIREDSIZE 1 - -#define WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(macro) \ - macro(readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCode, initializeReadableStreamDefaultController, ASCIILiteral(), s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeLength) \ - macro(readableStreamDefaultControllerEnqueueCode, enqueue, ASCIILiteral(), s_readableStreamDefaultControllerEnqueueCodeLength) \ - macro(readableStreamDefaultControllerErrorCode, error, ASCIILiteral(), s_readableStreamDefaultControllerErrorCodeLength) \ - macro(readableStreamDefaultControllerCloseCode, close, ASCIILiteral(), s_readableStreamDefaultControllerCloseCodeLength) \ - macro(readableStreamDefaultControllerDesiredSizeCode, desiredSize, "get desiredSize"_s, s_readableStreamDefaultControllerDesiredSizeCodeLength) \ - -#define WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(macro) \ - macro(close) \ - macro(desiredSize) \ - macro(enqueue) \ - macro(error) \ - macro(initializeReadableStreamDefaultController) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ReadableStreamDefaultControllerBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ReadableStreamDefaultControllerBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ReadableStreamDefaultControllerBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ReadableStreamDefaultControllerBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ReadableStreamDefaultReaderBuiltins.cpp b/src/bun.js/builtins/cpp/ReadableStreamDefaultReaderBuiltins.cpp deleted file mode 100644 index 2e8388a4f..000000000 --- a/src/bun.js/builtins/cpp/ReadableStreamDefaultReaderBuiltins.cpp +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "ReadableStreamDefaultReaderBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeLength = 393; -static const JSC::Intrinsic s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStream(stream))\n" \ - " @throwTypeError(\"ReadableStreamDefaultReader needs a ReadableStream\");\n" \ - " if (@isReadableStreamLocked(stream))\n" \ - " @throwTypeError(\"ReadableStream is locked\");\n" \ - "\n" \ - " @readableStreamReaderGenericInitialize(this, stream);\n" \ - " @putByIdDirectPrivate(this, \"readRequests\", @createFIFO());\n" \ - "\n" \ - " return this;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamDefaultReaderCancelCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultReaderCancelCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultReaderCancelCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultReaderCancelCodeLength = 416; -static const JSC::Intrinsic s_readableStreamDefaultReaderCancelCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultReaderCancelCode = - "(function (reason)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStreamDefaultReader(this))\n" \ - " return @Promise.@reject(@makeThisTypeError(\"ReadableStreamDefaultReader\", \"cancel\"));\n" \ - "\n" \ - " if (!@getByIdDirectPrivate(this, \"ownerReadableStream\"))\n" \ - " return @Promise.@reject(@makeTypeError(\"cancel() called on a reader owned by no readable stream\"));\n" \ - "\n" \ - " return @readableStreamReaderGenericCancel(this, reason);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamDefaultReaderReadManyCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultReaderReadManyCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultReaderReadManyCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultReaderReadManyCodeLength = 4743; -static const JSC::Intrinsic s_readableStreamDefaultReaderReadManyCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultReaderReadManyCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStreamDefaultReader(this))\n" \ - " @throwTypeError(\"ReadableStreamDefaultReader.readMany() should not be called directly\");\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(this, \"ownerReadableStream\");\n" \ - " if (!stream)\n" \ - " @throwTypeError(\"readMany() called on a reader owned by no readable stream\");\n" \ - "\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - " @putByIdDirectPrivate(stream, \"disturbed\", true);\n" \ - " if (state === @streamClosed)\n" \ - " return {value: [], size: 0, done: true};\n" \ - " else if (state === @streamErrored) {\n" \ - " throw @getByIdDirectPrivate(stream, \"storedError\");\n" \ - " }\n" \ - "\n" \ - " \n" \ - " var controller = @getByIdDirectPrivate(stream, \"readableStreamController\");\n" \ - " var queue = @getByIdDirectPrivate(controller, \"queue\");\n" \ - " \n" \ - " if (!queue) {\n" \ - " //\n" \ - " //\n" \ - " return controller.@pull(\n" \ - " controller\n" \ - " ).@then(\n" \ - " function({done, value}) {\n" \ - " return (\n" \ - " done ? \n" \ - " { done: true, value: [], size: 0 } : \n" \ - " { value: [value], size: 1, done: false }\n" \ - " );\n" \ - " }\n" \ - " );\n" \ - " }\n" \ - "\n" \ - " const content = queue.content;\n" \ - " var size = queue.size;\n" \ - " var values = content.toArray(false);\n" \ - " \n" \ - " var length = values.length;\n" \ - "\n" \ - " if (length > 0) {\n" \ - " var outValues = @newArrayWithSize(length);\n" \ - " if (@isReadableByteStreamController(controller)) {\n" \ - "\n" \ - " {\n" \ - " const buf = values[0];\n" \ - " if (!(@ArrayBuffer.@isView(buf) || buf instanceof @ArrayBuffer)) {\n" \ - " @putByValDirect(outValues, 0, new @Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength));\n" \ - " } else {\n" \ - " @putByValDirect(outValues, 0, buf);\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " for (var i = 1; i < length; i++) {\n" \ - " const buf = values[i];\n" \ - " if (!(@ArrayBuffer.@isView(buf) || buf instanceof @ArrayBuffer)) {\n" \ - " @putByValDirect(outValues, i, new @Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength));\n" \ - " } else {\n" \ - " @putByValDirect(outValues, i, buf);\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " } else {\n" \ - " @putByValDirect(outValues, 0, values[0].value);\n" \ - " for (var i = 1; i < length; i++) {\n" \ - " @putByValDirect(outValues, i, values[i].value);\n" \ - " }\n" \ - " }\n" \ - " \n" \ - " @resetQueue(@getByIdDirectPrivate(controller, \"queue\"));\n" \ - "\n" \ - " if (@getByIdDirectPrivate(controller, \"closeRequested\"))\n" \ - " @readableStreamClose(@getByIdDirectPrivate(controller, \"controlledReadableStream\"));\n" \ - " else if (@isReadableStreamDefaultController(controller)) \n" \ - " @readableStreamDefaultControllerCallPullIfNeeded(controller);\n" \ - " else if (@isReadableByteStreamController(controller))\n" \ - " @readableByteStreamControllerCallPullIfNeeded(controller);\n" \ - "\n" \ - " return {value: outValues, size, done: false};\n" \ - " }\n" \ - "\n" \ - " var onPullMany = (result) => {\n" \ - " if (result.done) {\n" \ - " return {value: [], size: 0, done: true};\n" \ - " }\n" \ - " var controller = @getByIdDirectPrivate(stream, \"readableStreamController\");\n" \ - " \n" \ - " var queue = @getByIdDirectPrivate(controller, \"queue\");\n" \ - " var value = [result.value].concat(queue.content.toArray(false));\n" \ - " var length = value.length;\n" \ - "\n" \ - " if (@isReadableByteStreamController(controller)) {\n" \ - " for (var i = 0; i < length; i++) {\n" \ - " const buf = value[i];\n" \ - " if (!(@ArrayBuffer.@isView(buf) || buf instanceof @ArrayBuffer)) {\n" \ - " const {buffer, byteOffset, byteLength} = buf;\n" \ - " @putByValDirect(value, i, new @Uint8Array(buffer, byteOffset, byteLength));\n" \ - " }\n" \ - " }\n" \ - " } else {\n" \ - " for (var i = 1; i < length; i++) {\n" \ - " @putByValDirect(value, i, value[i].value);\n" \ - " }\n" \ - " }\n" \ - " \n" \ - " var size = queue.size;\n" \ - " @resetQueue(queue);\n" \ - "\n" \ - " if (@getByIdDirectPrivate(controller, \"closeRequested\"))\n" \ - " @readableStreamClose(@getByIdDirectPrivate(controller, \"controlledReadableStream\"));\n" \ - " else if (@isReadableStreamDefaultController(controller)) \n" \ - " @readableStreamDefaultControllerCallPullIfNeeded(controller);\n" \ - " else if (@isReadableByteStreamController(controller))\n" \ - " @readableByteStreamControllerCallPullIfNeeded(controller);\n" \ - " \n" \ - "\n" \ - " \n" \ - " return {value: value, size: size, done: false};\n" \ - " };\n" \ - " \n" \ - " var pullResult = controller.@pull(controller);\n" \ - " if (pullResult && @isPromise(pullResult)) {\n" \ - " return pullResult.@then(onPullMany);\n" \ - " }\n" \ - "\n" \ - " return onPullMany(pullResult);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamDefaultReaderReadCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultReaderReadCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultReaderReadCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultReaderReadCodeLength = 395; -static const JSC::Intrinsic s_readableStreamDefaultReaderReadCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultReaderReadCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStreamDefaultReader(this))\n" \ - " return @Promise.@reject(@makeThisTypeError(\"ReadableStreamDefaultReader\", \"read\"));\n" \ - " if (!@getByIdDirectPrivate(this, \"ownerReadableStream\"))\n" \ - " return @Promise.@reject(@makeTypeError(\"read() called on a reader owned by no readable stream\"));\n" \ - "\n" \ - " return @readableStreamDefaultReaderRead(this);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamDefaultReaderReleaseLockCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultReaderReleaseLockCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultReaderReleaseLockCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultReaderReleaseLockCodeLength = 449; -static const JSC::Intrinsic s_readableStreamDefaultReaderReleaseLockCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultReaderReleaseLockCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStreamDefaultReader(this))\n" \ - " throw @makeThisTypeError(\"ReadableStreamDefaultReader\", \"releaseLock\");\n" \ - "\n" \ - " if (!@getByIdDirectPrivate(this, \"ownerReadableStream\"))\n" \ - " return;\n" \ - "\n" \ - " if (@getByIdDirectPrivate(this, \"readRequests\")?.isNotEmpty())\n" \ - " @throwTypeError(\"There are still pending read requests, cannot release the lock\");\n" \ - "\n" \ - " @readableStreamReaderGenericRelease(this);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamDefaultReaderClosedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamDefaultReaderClosedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamDefaultReaderClosedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamDefaultReaderClosedCodeLength = 257; -static const JSC::Intrinsic s_readableStreamDefaultReaderClosedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamDefaultReaderClosedCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStreamDefaultReader(this))\n" \ - " return @Promise.@reject(@makeGetterTypeError(\"ReadableStreamDefaultReader\", \"closed\"));\n" \ - "\n" \ - " return @getByIdDirectPrivate(this, \"closedPromiseCapability\").@promise;\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().readableStreamDefaultReaderBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().readableStreamDefaultReaderBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ReadableStreamDefaultReaderBuiltins.h b/src/bun.js/builtins/cpp/ReadableStreamDefaultReaderBuiltins.h deleted file mode 100644 index cd061220a..000000000 --- a/src/bun.js/builtins/cpp/ReadableStreamDefaultReaderBuiltins.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* ReadableStreamDefaultReader */ -extern const char* const s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCode; -extern const int s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeImplementationVisibility; -extern const char* const s_readableStreamDefaultReaderCancelCode; -extern const int s_readableStreamDefaultReaderCancelCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultReaderCancelCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultReaderCancelCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultReaderCancelCodeImplementationVisibility; -extern const char* const s_readableStreamDefaultReaderReadManyCode; -extern const int s_readableStreamDefaultReaderReadManyCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultReaderReadManyCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultReaderReadManyCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultReaderReadManyCodeImplementationVisibility; -extern const char* const s_readableStreamDefaultReaderReadCode; -extern const int s_readableStreamDefaultReaderReadCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultReaderReadCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultReaderReadCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultReaderReadCodeImplementationVisibility; -extern const char* const s_readableStreamDefaultReaderReleaseLockCode; -extern const int s_readableStreamDefaultReaderReleaseLockCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultReaderReleaseLockCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultReaderReleaseLockCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultReaderReleaseLockCodeImplementationVisibility; -extern const char* const s_readableStreamDefaultReaderClosedCode; -extern const int s_readableStreamDefaultReaderClosedCodeLength; -extern const JSC::ConstructAbility s_readableStreamDefaultReaderClosedCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamDefaultReaderClosedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamDefaultReaderClosedCodeImplementationVisibility; - -#define WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_DATA(macro) \ - macro(initializeReadableStreamDefaultReader, readableStreamDefaultReaderInitializeReadableStreamDefaultReader, 1) \ - macro(cancel, readableStreamDefaultReaderCancel, 1) \ - macro(readMany, readableStreamDefaultReaderReadMany, 0) \ - macro(read, readableStreamDefaultReaderRead, 0) \ - macro(releaseLock, readableStreamDefaultReaderReleaseLock, 0) \ - macro(closed, readableStreamDefaultReaderClosed, 0) \ - -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTREADER_INITIALIZEREADABLESTREAMDEFAULTREADER 1 -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTREADER_CANCEL 1 -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTREADER_READMANY 1 -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTREADER_READ 1 -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTREADER_RELEASELOCK 1 -#define WEBCORE_BUILTIN_READABLESTREAMDEFAULTREADER_CLOSED 1 - -#define WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_CODE(macro) \ - macro(readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCode, initializeReadableStreamDefaultReader, ASCIILiteral(), s_readableStreamDefaultReaderInitializeReadableStreamDefaultReaderCodeLength) \ - macro(readableStreamDefaultReaderCancelCode, cancel, ASCIILiteral(), s_readableStreamDefaultReaderCancelCodeLength) \ - macro(readableStreamDefaultReaderReadManyCode, readMany, ASCIILiteral(), s_readableStreamDefaultReaderReadManyCodeLength) \ - macro(readableStreamDefaultReaderReadCode, read, ASCIILiteral(), s_readableStreamDefaultReaderReadCodeLength) \ - macro(readableStreamDefaultReaderReleaseLockCode, releaseLock, ASCIILiteral(), s_readableStreamDefaultReaderReleaseLockCodeLength) \ - macro(readableStreamDefaultReaderClosedCode, closed, "get closed"_s, s_readableStreamDefaultReaderClosedCodeLength) \ - -#define WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_FUNCTION_NAME(macro) \ - macro(cancel) \ - macro(closed) \ - macro(initializeReadableStreamDefaultReader) \ - macro(read) \ - macro(readMany) \ - macro(releaseLock) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ReadableStreamDefaultReaderBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ReadableStreamDefaultReaderBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ReadableStreamDefaultReaderBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ReadableStreamDefaultReaderBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_READABLESTREAMDEFAULTREADER_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.cpp b/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.cpp deleted file mode 100644 index b7d388218..000000000 --- a/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.cpp +++ /dev/null @@ -1,2683 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "ReadableStreamInternalsBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeLength = 788; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamReaderGenericInitializeCode = - "(function (reader, stream) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " @putByIdDirectPrivate(reader, \"ownerReadableStream\", stream);\n" \ - " @putByIdDirectPrivate(stream, \"reader\", reader);\n" \ - " if (@getByIdDirectPrivate(stream, \"state\") === @streamReadable)\n" \ - " @putByIdDirectPrivate(\n" \ - " reader,\n" \ - " \"closedPromiseCapability\",\n" \ - " @newPromiseCapability(@Promise)\n" \ - " );\n" \ - " else if (@getByIdDirectPrivate(stream, \"state\") === @streamClosed)\n" \ - " @putByIdDirectPrivate(reader, \"closedPromiseCapability\", {\n" \ - " @promise: @Promise.@resolve(),\n" \ - " });\n" \ - " else {\n" \ - " @assert(@getByIdDirectPrivate(stream, \"state\") === @streamErrored);\n" \ - " @putByIdDirectPrivate(reader, \"closedPromiseCapability\", {\n" \ - " @promise: @newHandledRejectedPromise(\n" \ - " @getByIdDirectPrivate(stream, \"storedError\")\n" \ - " ),\n" \ - " });\n" \ - " }\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeLength = 873; -static const JSC::Intrinsic s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCode = - "(function (\n" \ - " stream,\n" \ - " underlyingSource,\n" \ - " size,\n" \ - " highWaterMark\n" \ - ") {\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isReadableStream(stream))\n" \ - " @throwTypeError(\"ReadableStreamDefaultController needs a ReadableStream\");\n" \ - "\n" \ - " //\n" \ - " if (@getByIdDirectPrivate(stream, \"readableStreamController\") !== null)\n" \ - " @throwTypeError(\"ReadableStream already has a controller\");\n" \ - "\n" \ - " @putByIdDirectPrivate(this, \"controlledReadableStream\", stream);\n" \ - " @putByIdDirectPrivate(this, \"underlyingSource\", underlyingSource);\n" \ - " @putByIdDirectPrivate(this, \"queue\", @newQueue());\n" \ - " @putByIdDirectPrivate(this, \"started\", -1);\n" \ - " @putByIdDirectPrivate(this, \"closeRequested\", false);\n" \ - " @putByIdDirectPrivate(this, \"pullAgain\", false);\n" \ - " @putByIdDirectPrivate(this, \"pulling\", false);\n" \ - " @putByIdDirectPrivate(\n" \ - " this,\n" \ - " \"strategy\",\n" \ - " @validateAndNormalizeQueuingStrategy(size, highWaterMark)\n" \ - " );\n" \ - "\n" \ - " return this;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeLength = 305; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerErrorCode = - "(function (controller, error) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n" \ - " if (@getByIdDirectPrivate(stream, \"state\") !== @streamReadable) return;\n" \ - " @putByIdDirectPrivate(controller, \"queue\", @newQueue());\n" \ - "\n" \ - " @readableStreamError(stream, error);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamPipeToCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamPipeToCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamPipeToCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamPipeToCodeLength = 739; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamPipeToCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamPipeToCode = - "(function (stream, sink) {\n" \ - " \"use strict\";\n" \ - " @assert(@isReadableStream(stream));\n" \ - "\n" \ - " const reader = new @ReadableStreamDefaultReader(stream);\n" \ - "\n" \ - " @getByIdDirectPrivate(reader, \"closedPromiseCapability\").@promise.@then(\n" \ - " () => {},\n" \ - " (e) => {\n" \ - " sink.error(e);\n" \ - " }\n" \ - " );\n" \ - "\n" \ - " function doPipe() {\n" \ - " @readableStreamDefaultReaderRead(reader).@then(\n" \ - " function (result) {\n" \ - " if (result.done) {\n" \ - " sink.close();\n" \ - " return;\n" \ - " }\n" \ - " try {\n" \ - " sink.enqueue(result.value);\n" \ - " } catch (e) {\n" \ - " sink.error(\"ReadableStream chunk enqueueing in the sink failed\");\n" \ - " return;\n" \ - " }\n" \ - " doPipe();\n" \ - " },\n" \ - " function (e) {\n" \ - " sink.error(e);\n" \ - " }\n" \ - " );\n" \ - " }\n" \ - " doPipe();\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeLength = 190; -static const JSC::Intrinsic s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsAcquireReadableStreamDefaultReaderCode = - "(function (stream) {\n" \ - " \"use strict\";\n" \ - " var start = @getByIdDirectPrivate(stream, \"start\");\n" \ - " if (start) {\n" \ - " start.@call(stream);\n" \ - " }\n" \ - "\n" \ - " return new @ReadableStreamDefaultReader(stream);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeLength = 975; -static const JSC::Intrinsic s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsSetupReadableStreamDefaultControllerCode = - "(function (\n" \ - " stream,\n" \ - " underlyingSource,\n" \ - " size,\n" \ - " highWaterMark,\n" \ - " startMethod,\n" \ - " pullMethod,\n" \ - " cancelMethod\n" \ - ") {\n" \ - " \"use strict\";\n" \ - "\n" \ - " const controller = new @ReadableStreamDefaultController(\n" \ - " stream,\n" \ - " underlyingSource,\n" \ - " size,\n" \ - " highWaterMark,\n" \ - " @isReadableStream\n" \ - " );\n" \ - "\n" \ - " const pullAlgorithm = () =>\n" \ - " @promiseInvokeOrNoopMethod(underlyingSource, pullMethod, [controller]);\n" \ - " const cancelAlgorithm = (reason) =>\n" \ - " @promiseInvokeOrNoopMethod(underlyingSource, cancelMethod, [reason]);\n" \ - "\n" \ - " @putByIdDirectPrivate(controller, \"pullAlgorithm\", pullAlgorithm);\n" \ - " @putByIdDirectPrivate(controller, \"cancelAlgorithm\", cancelAlgorithm);\n" \ - " @putByIdDirectPrivate(\n" \ - " controller,\n" \ - " \"pull\",\n" \ - " @readableStreamDefaultControllerPull\n" \ - " );\n" \ - " @putByIdDirectPrivate(\n" \ - " controller,\n" \ - " \"cancel\",\n" \ - " @readableStreamDefaultControllerCancel\n" \ - " );\n" \ - " @putByIdDirectPrivate(stream, \"readableStreamController\", controller);\n" \ - "\n" \ - " @readableStreamDefaultControllerStart(controller);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsCreateReadableStreamControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsCreateReadableStreamControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsCreateReadableStreamControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsCreateReadableStreamControllerCodeLength = 1243; -static const JSC::Intrinsic s_readableStreamInternalsCreateReadableStreamControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsCreateReadableStreamControllerCode = - "(function (stream, underlyingSource, strategy) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " const type = underlyingSource.type;\n" \ - " const typeString = @toString(type);\n" \ - "\n" \ - " if (typeString === \"bytes\") {\n" \ - " //\n" \ - " //\n" \ - "\n" \ - " if (strategy.highWaterMark === @undefined) strategy.highWaterMark = 0;\n" \ - " if (strategy.size !== @undefined)\n" \ - " @throwRangeError(\n" \ - " \"Strategy for a ReadableByteStreamController cannot have a size\"\n" \ - " );\n" \ - "\n" \ - " @putByIdDirectPrivate(\n" \ - " stream,\n" \ - " \"readableStreamController\",\n" \ - " new @ReadableByteStreamController(\n" \ - " stream,\n" \ - " underlyingSource,\n" \ - " strategy.highWaterMark,\n" \ - " @isReadableStream\n" \ - " )\n" \ - " );\n" \ - " } else if (typeString === \"direct\") {\n" \ - " var highWaterMark = strategy?.highWaterMark;\n" \ - " @initializeArrayBufferStream.@call(\n" \ - " stream,\n" \ - " underlyingSource,\n" \ - " highWaterMark\n" \ - " );\n" \ - " } else if (type === @undefined) {\n" \ - " if (strategy.highWaterMark === @undefined) strategy.highWaterMark = 1;\n" \ - "\n" \ - " @setupReadableStreamDefaultController(\n" \ - " stream,\n" \ - " underlyingSource,\n" \ - " strategy.size,\n" \ - " strategy.highWaterMark,\n" \ - " underlyingSource.start,\n" \ - " underlyingSource.pull,\n" \ - " underlyingSource.cancel\n" \ - " );\n" \ - " } else @throwRangeError(\"Invalid type for underlying source\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerStartCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerStartCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerStartCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerStartCodeLength = 762; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerStartCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerStartCode = - "(function (controller) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (@getByIdDirectPrivate(controller, \"started\") !== -1) return;\n" \ - "\n" \ - " const underlyingSource = @getByIdDirectPrivate(\n" \ - " controller,\n" \ - " \"underlyingSource\"\n" \ - " );\n" \ - " const startMethod = underlyingSource.start;\n" \ - " @putByIdDirectPrivate(controller, \"started\", 0);\n" \ - "\n" \ - " @promiseInvokeOrNoopMethodNoCatch(underlyingSource, startMethod, [\n" \ - " controller,\n" \ - " ]).@then(\n" \ - " () => {\n" \ - " @putByIdDirectPrivate(controller, \"started\", 1);\n" \ - " @assert(!@getByIdDirectPrivate(controller, \"pulling\"));\n" \ - " @assert(!@getByIdDirectPrivate(controller, \"pullAgain\"));\n" \ - " @readableStreamDefaultControllerCallPullIfNeeded(controller);\n" \ - " },\n" \ - " (error) => {\n" \ - " @readableStreamDefaultControllerError(controller, error);\n" \ - " }\n" \ - " );\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeLength = 3229; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamPipeToWritableStreamCode = - "(function (\n" \ - " source,\n" \ - " destination,\n" \ - " preventClose,\n" \ - " preventAbort,\n" \ - " preventCancel,\n" \ - " signal\n" \ - ") {\n" \ - " \"use strict\";\n" \ - "\n" \ - " const isDirectStream = !!@getByIdDirectPrivate(source, \"start\");\n" \ - "\n" \ - "\n" \ - " @assert(@isReadableStream(source));\n" \ - " @assert(@isWritableStream(destination));\n" \ - " @assert(!@isReadableStreamLocked(source));\n" \ - " @assert(!@isWritableStreamLocked(destination));\n" \ - " @assert(signal === @undefined || @isAbortSignal(signal));\n" \ - "\n" \ - " if (@getByIdDirectPrivate(source, \"underlyingByteSource\") !== @undefined)\n" \ - " return @Promise.@reject(\n" \ - " \"Piping to a readable bytestream is not supported\"\n" \ - " );\n" \ - "\n" \ - " let pipeState = {\n" \ - " source: source,\n" \ - " destination: destination,\n" \ - " preventAbort: preventAbort,\n" \ - " preventCancel: preventCancel,\n" \ - " preventClose: preventClose,\n" \ - " signal: signal,\n" \ - " };\n" \ - "\n" \ - " pipeState.reader = @acquireReadableStreamDefaultReader(source);\n" \ - " pipeState.writer = @acquireWritableStreamDefaultWriter(destination);\n" \ - "\n" \ - " @putByIdDirectPrivate(source, \"disturbed\", true);\n" \ - "\n" \ - " pipeState.finalized = false;\n" \ - " pipeState.shuttingDown = false;\n" \ - " pipeState.promiseCapability = @newPromiseCapability(@Promise);\n" \ - " pipeState.pendingReadPromiseCapability = @newPromiseCapability(@Promise);\n" \ - " pipeState.pendingReadPromiseCapability.@resolve.@call();\n" \ - " pipeState.pendingWritePromise = @Promise.@resolve();\n" \ - "\n" \ - " if (signal !== @undefined) {\n" \ - " const algorithm = (reason) => {\n" \ - " if (pipeState.finalized) return;\n" \ - "\n" \ - " @pipeToShutdownWithAction(\n" \ - " pipeState,\n" \ - " () => {\n" \ - " const shouldAbortDestination =\n" \ - " !pipeState.preventAbort &&\n" \ - " @getByIdDirectPrivate(pipeState.destination, \"state\") ===\n" \ - " \"writable\";\n" \ - " const promiseDestination = shouldAbortDestination\n" \ - " ? @writableStreamAbort(pipeState.destination, reason)\n" \ - " : @Promise.@resolve();\n" \ - "\n" \ - " const shouldAbortSource =\n" \ - " !pipeState.preventCancel &&\n" \ - " @getByIdDirectPrivate(pipeState.source, \"state\") ===\n" \ - " @streamReadable;\n" \ - " const promiseSource = shouldAbortSource\n" \ - " ? @readableStreamCancel(pipeState.source, reason)\n" \ - " : @Promise.@resolve();\n" \ - "\n" \ - " let promiseCapability = @newPromiseCapability(@Promise);\n" \ - " let shouldWait = true;\n" \ - " let handleResolvedPromise = () => {\n" \ - " if (shouldWait) {\n" \ - " shouldWait = false;\n" \ - " return;\n" \ - " }\n" \ - " promiseCapability.@resolve.@call();\n" \ - " };\n" \ - " let handleRejectedPromise = (e) => {\n" \ - " promiseCapability.@reject.@call(@undefined, e);\n" \ - " };\n" \ - " promiseDestination.@then(\n" \ - " handleResolvedPromise,\n" \ - " handleRejectedPromise\n" \ - " );\n" \ - " promiseSource.@then(handleResolvedPromise, handleRejectedPromise);\n" \ - " return promiseCapability.@promise;\n" \ - " },\n" \ - " reason\n" \ - " );\n" \ - " };\n" \ - " if (@whenSignalAborted(signal, algorithm))\n" \ - " return pipeState.promiseCapability.@promise;\n" \ - " }\n" \ - "\n" \ - " @pipeToErrorsMustBePropagatedForward(pipeState);\n" \ - " @pipeToErrorsMustBePropagatedBackward(pipeState);\n" \ - " @pipeToClosingMustBePropagatedForward(pipeState);\n" \ - " @pipeToClosingMustBePropagatedBackward(pipeState);\n" \ - "\n" \ - " @pipeToLoop(pipeState);\n" \ - "\n" \ - " return pipeState.promiseCapability.@promise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsPipeToLoopCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPipeToLoopCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPipeToLoopCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToLoopCodeLength = 180; -static const JSC::Intrinsic s_readableStreamInternalsPipeToLoopCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToLoopCode = - "(function (pipeState) {\n" \ - " \"use strict\";\n" \ - " if (pipeState.shuttingDown) return;\n" \ - "\n" \ - " @pipeToDoReadWrite(pipeState).@then((result) => {\n" \ - " if (result) @pipeToLoop(pipeState);\n" \ - " });\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsPipeToDoReadWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPipeToDoReadWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPipeToDoReadWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToDoReadWriteCodeLength = 1296; -static const JSC::Intrinsic s_readableStreamInternalsPipeToDoReadWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToDoReadWriteCode = - "(function (pipeState) {\n" \ - " \"use strict\";\n" \ - " @assert(!pipeState.shuttingDown);\n" \ - "\n" \ - " pipeState.pendingReadPromiseCapability = @newPromiseCapability(@Promise);\n" \ - " @getByIdDirectPrivate(pipeState.writer, \"readyPromise\").@promise.@then(\n" \ - " () => {\n" \ - " if (pipeState.shuttingDown) {\n" \ - " pipeState.pendingReadPromiseCapability.@resolve.@call(\n" \ - " @undefined,\n" \ - " false\n" \ - " );\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " @readableStreamDefaultReaderRead(pipeState.reader).@then(\n" \ - " (result) => {\n" \ - " const canWrite =\n" \ - " !result.done &&\n" \ - " @getByIdDirectPrivate(pipeState.writer, \"stream\") !== @undefined;\n" \ - " pipeState.pendingReadPromiseCapability.@resolve.@call(\n" \ - " @undefined,\n" \ - " canWrite\n" \ - " );\n" \ - " if (!canWrite) return;\n" \ - "\n" \ - " pipeState.pendingWritePromise = @writableStreamDefaultWriterWrite(\n" \ - " pipeState.writer,\n" \ - " result.value\n" \ - " );\n" \ - " },\n" \ - " (e) => {\n" \ - " pipeState.pendingReadPromiseCapability.@resolve.@call(\n" \ - " @undefined,\n" \ - " false\n" \ - " );\n" \ - " }\n" \ - " );\n" \ - " },\n" \ - " (e) => {\n" \ - " pipeState.pendingReadPromiseCapability.@resolve.@call(\n" \ - " @undefined,\n" \ - " false\n" \ - " );\n" \ - " }\n" \ - " );\n" \ - " return pipeState.pendingReadPromiseCapability.@promise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeLength = 687; -static const JSC::Intrinsic s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCode = - "(function (pipeState) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " const action = () => {\n" \ - " pipeState.pendingReadPromiseCapability.@resolve.@call(@undefined, false);\n" \ - " const error = @getByIdDirectPrivate(pipeState.source, \"storedError\");\n" \ - " if (!pipeState.preventAbort) {\n" \ - " @pipeToShutdownWithAction(\n" \ - " pipeState,\n" \ - " () => @writableStreamAbort(pipeState.destination, error),\n" \ - " error\n" \ - " );\n" \ - " return;\n" \ - " }\n" \ - " @pipeToShutdown(pipeState, error);\n" \ - " };\n" \ - "\n" \ - " if (@getByIdDirectPrivate(pipeState.source, \"state\") === @streamErrored) {\n" \ - " action();\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " @getByIdDirectPrivate(\n" \ - " pipeState.reader,\n" \ - " \"closedPromiseCapability\"\n" \ - " ).@promise.@then(@undefined, action);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeLength = 598; -static const JSC::Intrinsic s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCode = - "(function (pipeState) {\n" \ - " \"use strict\";\n" \ - " const action = () => {\n" \ - " const error = @getByIdDirectPrivate(pipeState.destination, \"storedError\");\n" \ - " if (!pipeState.preventCancel) {\n" \ - " @pipeToShutdownWithAction(\n" \ - " pipeState,\n" \ - " () => @readableStreamCancel(pipeState.source, error),\n" \ - " error\n" \ - " );\n" \ - " return;\n" \ - " }\n" \ - " @pipeToShutdown(pipeState, error);\n" \ - " };\n" \ - " if (@getByIdDirectPrivate(pipeState.destination, \"state\") === \"errored\") {\n" \ - " action();\n" \ - " return;\n" \ - " }\n" \ - " @getByIdDirectPrivate(pipeState.writer, \"closedPromise\").@promise.@then(\n" \ - " @undefined,\n" \ - " action\n" \ - " );\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeLength = 673; -static const JSC::Intrinsic s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCode = - "(function (pipeState) {\n" \ - " \"use strict\";\n" \ - " const action = () => {\n" \ - " pipeState.pendingReadPromiseCapability.@resolve.@call(@undefined, false);\n" \ - " const error = @getByIdDirectPrivate(pipeState.source, \"storedError\");\n" \ - " if (!pipeState.preventClose) {\n" \ - " @pipeToShutdownWithAction(pipeState, () =>\n" \ - " @writableStreamDefaultWriterCloseWithErrorPropagation(pipeState.writer)\n" \ - " );\n" \ - " return;\n" \ - " }\n" \ - " @pipeToShutdown(pipeState);\n" \ - " };\n" \ - " if (@getByIdDirectPrivate(pipeState.source, \"state\") === @streamClosed) {\n" \ - " action();\n" \ - " return;\n" \ - " }\n" \ - " @getByIdDirectPrivate(\n" \ - " pipeState.reader,\n" \ - " \"closedPromiseCapability\"\n" \ - " ).@promise.@then(action, @undefined);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeLength = 492; -static const JSC::Intrinsic s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCode = - "(function (pipeState) {\n" \ - " \"use strict\";\n" \ - " if (\n" \ - " !@writableStreamCloseQueuedOrInFlight(pipeState.destination) &&\n" \ - " @getByIdDirectPrivate(pipeState.destination, \"state\") !== \"closed\"\n" \ - " )\n" \ - " return;\n" \ - "\n" \ - " //\n" \ - "\n" \ - " const error = @makeTypeError(\"closing is propagated backward\");\n" \ - " if (!pipeState.preventCancel) {\n" \ - " @pipeToShutdownWithAction(\n" \ - " pipeState,\n" \ - " () => @readableStreamCancel(pipeState.source, error),\n" \ - " error\n" \ - " );\n" \ - " return;\n" \ - " }\n" \ - " @pipeToShutdown(pipeState, error);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsPipeToShutdownWithActionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPipeToShutdownWithActionCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPipeToShutdownWithActionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToShutdownWithActionCodeLength = 850; -static const JSC::Intrinsic s_readableStreamInternalsPipeToShutdownWithActionCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToShutdownWithActionCode = - "(function (pipeState, action) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (pipeState.shuttingDown) return;\n" \ - "\n" \ - " pipeState.shuttingDown = true;\n" \ - "\n" \ - " const hasError = arguments.length > 2;\n" \ - " const error = arguments[2];\n" \ - " const finalize = () => {\n" \ - " const promise = action();\n" \ - " promise.@then(\n" \ - " () => {\n" \ - " if (hasError) @pipeToFinalize(pipeState, error);\n" \ - " else @pipeToFinalize(pipeState);\n" \ - " },\n" \ - " (e) => {\n" \ - " @pipeToFinalize(pipeState, e);\n" \ - " }\n" \ - " );\n" \ - " };\n" \ - "\n" \ - " if (\n" \ - " @getByIdDirectPrivate(pipeState.destination, \"state\") === \"writable\" &&\n" \ - " !@writableStreamCloseQueuedOrInFlight(pipeState.destination)\n" \ - " ) {\n" \ - " pipeState.pendingReadPromiseCapability.@promise.@then(\n" \ - " () => {\n" \ - " pipeState.pendingWritePromise.@then(finalize, finalize);\n" \ - " },\n" \ - " (e) => @pipeToFinalize(pipeState, e)\n" \ - " );\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " finalize();\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsPipeToShutdownCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPipeToShutdownCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPipeToShutdownCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToShutdownCodeLength = 692; -static const JSC::Intrinsic s_readableStreamInternalsPipeToShutdownCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToShutdownCode = - "(function (pipeState) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (pipeState.shuttingDown) return;\n" \ - "\n" \ - " pipeState.shuttingDown = true;\n" \ - "\n" \ - " const hasError = arguments.length > 1;\n" \ - " const error = arguments[1];\n" \ - " const finalize = () => {\n" \ - " if (hasError) @pipeToFinalize(pipeState, error);\n" \ - " else @pipeToFinalize(pipeState);\n" \ - " };\n" \ - "\n" \ - " if (\n" \ - " @getByIdDirectPrivate(pipeState.destination, \"state\") === \"writable\" &&\n" \ - " !@writableStreamCloseQueuedOrInFlight(pipeState.destination)\n" \ - " ) {\n" \ - " pipeState.pendingReadPromiseCapability.@promise.@then(\n" \ - " () => {\n" \ - " pipeState.pendingWritePromise.@then(finalize, finalize);\n" \ - " },\n" \ - " (e) => @pipeToFinalize(pipeState, e)\n" \ - " );\n" \ - " return;\n" \ - " }\n" \ - " finalize();\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsPipeToFinalizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsPipeToFinalizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsPipeToFinalizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsPipeToFinalizeCodeLength = 349; -static const JSC::Intrinsic s_readableStreamInternalsPipeToFinalizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsPipeToFinalizeCode = - "(function (pipeState) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " @writableStreamDefaultWriterRelease(pipeState.writer);\n" \ - " @readableStreamReaderGenericRelease(pipeState.reader);\n" \ - "\n" \ - " //\n" \ - " pipeState.finalized = true;\n" \ - "\n" \ - " if (arguments.length > 1)\n" \ - " pipeState.promiseCapability.@reject.@call(@undefined, arguments[1]);\n" \ - " else pipeState.promiseCapability.@resolve.@call();\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamTeeCodeLength = 1839; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamTeeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamTeeCode = - "(function (stream, shouldClone) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@isReadableStream(stream));\n" \ - " @assert(typeof shouldClone === \"boolean\");\n" \ - "\n" \ - " var start_ = @getByIdDirectPrivate(stream, \"start\");\n" \ - " if (start_) {\n" \ - " @putByIdDirectPrivate(stream, \"start\", @undefined);\n" \ - " start_();\n" \ - " }\n" \ - "\n" \ - " const reader = new @ReadableStreamDefaultReader(stream);\n" \ - "\n" \ - " const teeState = {\n" \ - " closedOrErrored: false,\n" \ - " canceled1: false,\n" \ - " canceled2: false,\n" \ - " reason1: @undefined,\n" \ - " reason2: @undefined,\n" \ - " };\n" \ - "\n" \ - " teeState.cancelPromiseCapability = @newPromiseCapability(@Promise);\n" \ - "\n" \ - " const pullFunction = @readableStreamTeePullFunction(\n" \ - " teeState,\n" \ - " reader,\n" \ - " shouldClone\n" \ - " );\n" \ - "\n" \ - " const branch1Source = {};\n" \ - " @putByIdDirectPrivate(branch1Source, \"pull\", pullFunction);\n" \ - " @putByIdDirectPrivate(\n" \ - " branch1Source,\n" \ - " \"cancel\",\n" \ - " @readableStreamTeeBranch1CancelFunction(teeState, stream)\n" \ - " );\n" \ - "\n" \ - " const branch2Source = {};\n" \ - " @putByIdDirectPrivate(branch2Source, \"pull\", pullFunction);\n" \ - " @putByIdDirectPrivate(\n" \ - " branch2Source,\n" \ - " \"cancel\",\n" \ - " @readableStreamTeeBranch2CancelFunction(teeState, stream)\n" \ - " );\n" \ - "\n" \ - " const branch1 = new @ReadableStream(branch1Source);\n" \ - " const branch2 = new @ReadableStream(branch2Source);\n" \ - "\n" \ - " @getByIdDirectPrivate(reader, \"closedPromiseCapability\").@promise.@then(\n" \ - " @undefined,\n" \ - " function (e) {\n" \ - " if (teeState.closedOrErrored) return;\n" \ - " @readableStreamDefaultControllerError(\n" \ - " branch1.@readableStreamController,\n" \ - " e\n" \ - " );\n" \ - " @readableStreamDefaultControllerError(\n" \ - " branch2.@readableStreamController,\n" \ - " e\n" \ - " );\n" \ - " teeState.closedOrErrored = true;\n" \ - " if (!teeState.canceled1 || !teeState.canceled2)\n" \ - " teeState.cancelPromiseCapability.@resolve.@call();\n" \ - " }\n" \ - " );\n" \ - "\n" \ - " //\n" \ - " teeState.branch1 = branch1;\n" \ - " teeState.branch2 = branch2;\n" \ - "\n" \ - " return [branch1, branch2];\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeePullFunctionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeePullFunctionCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeePullFunctionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamTeePullFunctionCodeLength = 1336; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamTeePullFunctionCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamTeePullFunctionCode = - "(function (teeState, reader, shouldClone) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " return function () {\n" \ - " @Promise.prototype.@then.@call(\n" \ - " @readableStreamDefaultReaderRead(reader),\n" \ - " function (result) {\n" \ - " @assert(@isObject(result));\n" \ - " @assert(typeof result.done === \"boolean\");\n" \ - " if (result.done && !teeState.closedOrErrored) {\n" \ - " if (!teeState.canceled1)\n" \ - " @readableStreamDefaultControllerClose(\n" \ - " teeState.branch1.@readableStreamController\n" \ - " );\n" \ - " if (!teeState.canceled2)\n" \ - " @readableStreamDefaultControllerClose(\n" \ - " teeState.branch2.@readableStreamController\n" \ - " );\n" \ - " teeState.closedOrErrored = true;\n" \ - " if (!teeState.canceled1 || !teeState.canceled2)\n" \ - " teeState.cancelPromiseCapability.@resolve.@call();\n" \ - " }\n" \ - " if (teeState.closedOrErrored) return;\n" \ - " if (!teeState.canceled1)\n" \ - " @readableStreamDefaultControllerEnqueue(\n" \ - " teeState.branch1.@readableStreamController,\n" \ - " result.value\n" \ - " );\n" \ - " if (!teeState.canceled2)\n" \ - " @readableStreamDefaultControllerEnqueue(\n" \ - " teeState.branch2.@readableStreamController,\n" \ - " shouldClone\n" \ - " ? @structuredCloneForStream(result.value)\n" \ - " : result.value\n" \ - " );\n" \ - " }\n" \ - " );\n" \ - " };\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeLength = 442; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCode = - "(function (teeState, stream) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " return function (r) {\n" \ - " teeState.canceled1 = true;\n" \ - " teeState.reason1 = r;\n" \ - " if (teeState.canceled2) {\n" \ - " @readableStreamCancel(stream, [\n" \ - " teeState.reason1,\n" \ - " teeState.reason2,\n" \ - " ]).@then(\n" \ - " teeState.cancelPromiseCapability.@resolve,\n" \ - " teeState.cancelPromiseCapability.@reject\n" \ - " );\n" \ - " }\n" \ - " return teeState.cancelPromiseCapability.@promise;\n" \ - " };\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeLength = 442; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCode = - "(function (teeState, stream) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " return function (r) {\n" \ - " teeState.canceled2 = true;\n" \ - " teeState.reason2 = r;\n" \ - " if (teeState.canceled1) {\n" \ - " @readableStreamCancel(stream, [\n" \ - " teeState.reason1,\n" \ - " teeState.reason2,\n" \ - " ]).@then(\n" \ - " teeState.cancelPromiseCapability.@resolve,\n" \ - " teeState.cancelPromiseCapability.@reject\n" \ - " );\n" \ - " }\n" \ - " return teeState.cancelPromiseCapability.@promise;\n" \ - " };\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsIsReadableStreamCodeLength = 174; -static const JSC::Intrinsic s_readableStreamInternalsIsReadableStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsIsReadableStreamCode = - "(function (stream) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " return (\n" \ - " @isObject(stream) &&\n" \ - " @getByIdDirectPrivate(stream, \"readableStreamController\") !== @undefined\n" \ - " );\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamDefaultReaderCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamDefaultReaderCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamDefaultReaderCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsIsReadableStreamDefaultReaderCodeLength = 135; -static const JSC::Intrinsic s_readableStreamInternalsIsReadableStreamDefaultReaderCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsIsReadableStreamDefaultReaderCode = - "(function (reader) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " return @isObject(reader) && !!@getByIdDirectPrivate(reader, \"readRequests\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamDefaultControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsIsReadableStreamDefaultControllerCodeLength = 170; -static const JSC::Intrinsic s_readableStreamInternalsIsReadableStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsIsReadableStreamDefaultControllerCode = - "(function (controller) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " return (\n" \ - " @isObject(controller) &&\n" \ - " !!@getByIdDirectPrivate(controller, \"underlyingSource\")\n" \ - " );\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadDirectStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadDirectStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadDirectStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadDirectStreamCodeLength = 1583; -static const JSC::Intrinsic s_readableStreamInternalsReadDirectStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadDirectStreamCode = - "(function (stream, sink, underlyingSource) {\n" \ - " \"use strict\";\n" \ - " \n" \ - " @putByIdDirectPrivate(stream, \"underlyingSource\", @undefined);\n" \ - " @putByIdDirectPrivate(stream, \"start\", @undefined);\n" \ - "\n" \ - " function close(stream, reason) {\n" \ - " if (reason && underlyingSource?.cancel) {\n" \ - " try {\n" \ - " var prom = underlyingSource.cancel(reason);\n" \ - " @markPromiseAsHandled(prom);\n" \ - " } catch (e) {\n" \ - " }\n" \ - "\n" \ - " underlyingSource = @undefined;\n" \ - " }\n" \ - "\n" \ - " if (stream) {\n" \ - " @putByIdDirectPrivate(stream, \"readableStreamController\", @undefined);\n" \ - " @putByIdDirectPrivate(stream, \"reader\", @undefined);\n" \ - " if (reason) {\n" \ - " @putByIdDirectPrivate(stream, \"state\", @streamErrored);\n" \ - " @putByIdDirectPrivate(stream, \"storedError\", reason);\n" \ - " } else {\n" \ - " @putByIdDirectPrivate(stream, \"state\", @streamClosed);\n" \ - " }\n" \ - " stream = @undefined;\n" \ - " }\n" \ - " }\n" \ - "\n" \ - "\n" \ - "\n" \ - "\n" \ - "\n" \ - " if (!underlyingSource.pull) {\n" \ - " close();\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " if (!@isCallable(underlyingSource.pull)) {\n" \ - " close();\n" \ - " @throwTypeError(\"pull is not a function\");\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"readableStreamController\", sink);\n" \ - " const highWaterMark = @getByIdDirectPrivate(stream, \"highWaterMark\");\n" \ - "\n" \ - " sink.start({\n" \ - " highWaterMark: !highWaterMark || highWaterMark < 64 ? 64 : highWaterMark,\n" \ - " });\n" \ - "\n" \ - " @startDirectStream.@call(sink, stream, underlyingSource.pull, close);\n" \ - " @putByIdDirectPrivate(stream, \"reader\", {});\n" \ - "\n" \ - " var maybePromise = underlyingSource.pull(sink);\n" \ - " sink = @undefined;\n" \ - " if (maybePromise && @isPromise(maybePromise)) {\n" \ - " return maybePromise.@then(() => {});\n" \ - " }\n" \ - "\n" \ - "\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsAssignToStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsAssignToStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsAssignToStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsAssignToStreamCodeLength = 438; -static const JSC::Intrinsic s_readableStreamInternalsAssignToStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsAssignToStreamCode = - "(function (stream, sink) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " //\n" \ - " var underlyingSource = @getByIdDirectPrivate(stream, \"underlyingSource\");\n" \ - "\n" \ - " //\n" \ - " if (underlyingSource) {\n" \ - " try {\n" \ - " return @readDirectStream(stream, sink, underlyingSource);\n" \ - " } catch(e) {\n" \ - " throw e;\n" \ - " } finally {\n" \ - " underlyingSource = @undefined;\n" \ - " stream = @undefined;\n" \ - " sink = @undefined;\n" \ - " }\n" \ - " \n" \ - "\n" \ - " }\n" \ - "\n" \ - " return @readStreamIntoSink(stream, sink, true);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadStreamIntoSinkCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadStreamIntoSinkCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadStreamIntoSinkCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadStreamIntoSinkCodeLength = 2869; -static const JSC::Intrinsic s_readableStreamInternalsReadStreamIntoSinkCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadStreamIntoSinkCode = - "(async function (stream, sink, isNative) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " var didClose = false;\n" \ - " var didThrow = false;\n" \ - " try {\n" \ - " var reader = stream.getReader();\n" \ - " var many = reader.readMany();\n" \ - " if (many && @isPromise(many)) {\n" \ - " many = await many;\n" \ - " }\n" \ - " if (many.done) {\n" \ - " didClose = true;\n" \ - " return sink.end();\n" \ - " }\n" \ - " var wroteCount = many.value.length;\n" \ - " const highWaterMark = @getByIdDirectPrivate(stream, \"highWaterMark\");\n" \ - " if (isNative) @startDirectStream.@call(sink, stream, @undefined, () => !didThrow && @markPromiseAsHandled(stream.cancel()));\n" \ - "\n" \ - " sink.start({ highWaterMark: highWaterMark || 0 });\n" \ - " \n" \ - "\n" \ - " for (\n" \ - " var i = 0, values = many.value, length = many.value.length;\n" \ - " i < length;\n" \ - " i++\n" \ - " ) {\n" \ - " sink.write(values[i]);\n" \ - " }\n" \ - "\n" \ - " var streamState = @getByIdDirectPrivate(stream, \"state\");\n" \ - " if (streamState === @streamClosed) {\n" \ - " didClose = true;\n" \ - " return sink.end();\n" \ - " }\n" \ - "\n" \ - " while (true) {\n" \ - " var { value, done } = await reader.read();\n" \ - " if (done) {\n" \ - " didClose = true;\n" \ - " return sink.end();\n" \ - " }\n" \ - "\n" \ - " sink.write(value);\n" \ - " }\n" \ - " } catch (e) {\n" \ - " didThrow = true;\n" \ - "\n" \ - "\n" \ - " try {\n" \ - " reader = @undefined;\n" \ - " const prom = stream.cancel(e);\n" \ - " @markPromiseAsHandled(prom);\n" \ - " } catch (j) {}\n" \ - "\n" \ - " if (sink && !didClose) {\n" \ - " didClose = true;\n" \ - " try {\n" \ - " sink.close(e);\n" \ - " } catch (j) {\n" \ - " throw new globalThis.AggregateError([e, j]);\n" \ - " }\n" \ - " }\n" \ - "\n" \ - "\n" \ - " throw e;\n" \ - " } finally {\n" \ - " if (reader) {\n" \ - " try {\n" \ - " reader.releaseLock();\n" \ - " } catch (e) {}\n" \ - " reader = @undefined;\n" \ - " }\n" \ - " sink = @undefined;\n" \ - " var streamState = @getByIdDirectPrivate(stream, \"state\");\n" \ - " if (stream) {\n" \ - "\n" \ - " //\n" \ - " //\n" \ - " var readableStreamController = @getByIdDirectPrivate(\n" \ - " stream,\n" \ - " \"readableStreamController\"\n" \ - " );\n" \ - " if (readableStreamController) {\n" \ - " if (\n" \ - " @getByIdDirectPrivate(readableStreamController, \"underlyingSource\")\n" \ - " )\n" \ - " @putByIdDirectPrivate(\n" \ - " readableStreamController,\n" \ - " \"underlyingSource\",\n" \ - " @undefined\n" \ - " );\n" \ - " if (\n" \ - " @getByIdDirectPrivate(\n" \ - " readableStreamController,\n" \ - " \"controlledReadableStream\"\n" \ - " )\n" \ - " )\n" \ - " @putByIdDirectPrivate(\n" \ - " readableStreamController,\n" \ - " \"controlledReadableStream\",\n" \ - " @undefined\n" \ - " );\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"readableStreamController\", null);\n" \ - " if (@getByIdDirectPrivate(stream, \"underlyingSource\"))\n" \ - " @putByIdDirectPrivate(stream, \"underlyingSource\", @undefined);\n" \ - " readableStreamController = @undefined;\n" \ - " }\n" \ - "\n" \ - " if (!didThrow && streamState !== @streamClosed && streamState !== @streamErrored) {\n" \ - " @readableStreamClose(stream);\n" \ - " }\n" \ - " stream = @undefined;\n" \ - "\n" \ - " \n" \ - " }\n" \ - " }\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsHandleDirectStreamErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsHandleDirectStreamErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsHandleDirectStreamErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsHandleDirectStreamErrorCodeLength = 774; -static const JSC::Intrinsic s_readableStreamInternalsHandleDirectStreamErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsHandleDirectStreamErrorCode = - "(function (e) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " var controller = this;\n" \ - " var sink = controller.@sink;\n" \ - " if (sink) {\n" \ - " @putByIdDirectPrivate(controller, \"sink\", @undefined);\n" \ - " try {\n" \ - " sink.close(e);\n" \ - " } catch (f) {}\n" \ - " }\n" \ - "\n" \ - " this.error =\n" \ - " this.flush =\n" \ - " this.write =\n" \ - " this.close =\n" \ - " this.end =\n" \ - " @onReadableStreamDirectControllerClosed;\n" \ - "\n" \ - " if (typeof this.@underlyingSource.close === \"function\") {\n" \ - " try {\n" \ - " this.@underlyingSource.close.@call(this.@underlyingSource, e);\n" \ - " } catch (e) {}\n" \ - " }\n" \ - "\n" \ - " try {\n" \ - " var pend = controller._pendingRead;\n" \ - " if (pend) {\n" \ - " controller._pendingRead = @undefined;\n" \ - " @rejectPromise(pend, e);\n" \ - " }\n" \ - " } catch (f) {}\n" \ - " var stream = controller.@controlledReadableStream;\n" \ - " if (stream) @readableStreamError(stream, e);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsHandleDirectStreamErrorRejectCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsHandleDirectStreamErrorRejectCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsHandleDirectStreamErrorRejectCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsHandleDirectStreamErrorRejectCodeLength = 92; -static const JSC::Intrinsic s_readableStreamInternalsHandleDirectStreamErrorRejectCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsHandleDirectStreamErrorRejectCode = - "(function (e) {\n" \ - " @handleDirectStreamError.@call(this, e);\n" \ - " return @Promise.@reject(e);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsOnPullDirectStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsOnPullDirectStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsOnPullDirectStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsOnPullDirectStreamCodeLength = 1503; -static const JSC::Intrinsic s_readableStreamInternalsOnPullDirectStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsOnPullDirectStreamCode = - "(function (controller) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " var stream = controller.@controlledReadableStream;\n" \ - " if (!stream || @getByIdDirectPrivate(stream, \"state\") !== @streamReadable)\n" \ - " return;\n" \ - "\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " if (controller._deferClose === -1) {\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " controller._deferClose = -1;\n" \ - " controller._deferFlush = -1;\n" \ - " var deferClose;\n" \ - " var deferFlush;\n" \ - "\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " try {\n" \ - " var result = controller.@underlyingSource.pull(controller);\n" \ - "\n" \ - " if (result && @isPromise(result)) {\n" \ - " if (controller._handleError === @undefined) {\n" \ - " controller._handleError =\n" \ - " @handleDirectStreamErrorReject.bind(controller);\n" \ - " }\n" \ - "\n" \ - " @Promise.prototype.catch.@call(result, controller._handleError);\n" \ - " }\n" \ - " } catch (e) {\n" \ - " return @handleDirectStreamErrorReject.@call(controller, e);\n" \ - " } finally {\n" \ - " deferClose = controller._deferClose;\n" \ - " deferFlush = controller._deferFlush;\n" \ - " controller._deferFlush = controller._deferClose = 0;\n" \ - " }\n" \ - "\n" \ - " var promiseToReturn;\n" \ - "\n" \ - " if (controller._pendingRead === @undefined) {\n" \ - " controller._pendingRead = promiseToReturn = @newPromise();\n" \ - " } else {\n" \ - " promiseToReturn = @readableStreamAddReadRequest(stream);\n" \ - " }\n" \ - "\n" \ - " //\n" \ - " //\n" \ - " if (deferClose === 1) {\n" \ - " var reason = controller._deferCloseReason;\n" \ - " controller._deferCloseReason = @undefined;\n" \ - " @onCloseDirectStream.@call(controller, reason);\n" \ - " return promiseToReturn;\n" \ - " }\n" \ - "\n" \ - " //\n" \ - " if (deferFlush === 1) {\n" \ - " @onFlushDirectStream.@call(controller);\n" \ - " }\n" \ - "\n" \ - " return promiseToReturn;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsNoopDoneFunctionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsNoopDoneFunctionCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsNoopDoneFunctionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsNoopDoneFunctionCodeLength = 81; -static const JSC::Intrinsic s_readableStreamInternalsNoopDoneFunctionCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsNoopDoneFunctionCode = - "(function () {\n" \ - " return @Promise.@resolve({ value: @undefined, done: true });\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeLength = 107; -static const JSC::Intrinsic s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsOnReadableStreamDirectControllerClosedCode = - "(function (reason) {\n" \ - " \"use strict\";\n" \ - " @throwTypeError(\"ReadableStreamDirectController is now closed\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsOnCloseDirectStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsOnCloseDirectStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsOnCloseDirectStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsOnCloseDirectStreamCodeLength = 2190; -static const JSC::Intrinsic s_readableStreamInternalsOnCloseDirectStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsOnCloseDirectStreamCode = - "(function (reason) {\n" \ - " \"use strict\";\n" \ - " var stream = this.@controlledReadableStream;\n" \ - " if (!stream || @getByIdDirectPrivate(stream, \"state\") !== @streamReadable)\n" \ - " return;\n" \ - "\n" \ - " if (this._deferClose !== 0) {\n" \ - " this._deferClose = 1;\n" \ - " this._deferCloseReason = reason;\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"state\", @streamClosing);\n" \ - " if (typeof this.@underlyingSource.close === \"function\") {\n" \ - " try {\n" \ - " this.@underlyingSource.close.@call(this.@underlyingSource, reason);\n" \ - " } catch (e) {}\n" \ - " }\n" \ - "\n" \ - " var flushed;\n" \ - " try {\n" \ - " flushed = this.@sink.end();\n" \ - " @putByIdDirectPrivate(this, \"sink\", @undefined);\n" \ - " } catch (e) {\n" \ - " if (this._pendingRead) {\n" \ - " var read = this._pendingRead;\n" \ - " this._pendingRead = @undefined;\n" \ - " @rejectPromise(read, e);\n" \ - " }\n" \ - " @readableStreamError(stream, e);\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " this.error =\n" \ - " this.flush =\n" \ - " this.write =\n" \ - " this.close =\n" \ - " this.end =\n" \ - " @onReadableStreamDirectControllerClosed;\n" \ - "\n" \ - " var reader = @getByIdDirectPrivate(stream, \"reader\");\n" \ - "\n" \ - " if (reader && @isReadableStreamDefaultReader(reader)) {\n" \ - " var _pendingRead = this._pendingRead;\n" \ - " if (_pendingRead && @isPromise(_pendingRead) && flushed?.byteLength) {\n" \ - " this._pendingRead = @undefined;\n" \ - " @fulfillPromise(_pendingRead, { value: flushed, done: false });\n" \ - " @readableStreamClose(stream);\n" \ - " return;\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " if (flushed?.byteLength) {\n" \ - " var requests = @getByIdDirectPrivate(reader, \"readRequests\");\n" \ - " if (requests?.isNotEmpty()) {\n" \ - " @readableStreamFulfillReadRequest(stream, flushed, false);\n" \ - " @readableStreamClose(stream);\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"state\", @streamReadable);\n" \ - " this.@pull = () => {\n" \ - " var thisResult = @createFulfilledPromise({\n" \ - " value: flushed,\n" \ - " done: false,\n" \ - " });\n" \ - " flushed = @undefined;\n" \ - " @readableStreamClose(stream);\n" \ - " stream = @undefined;\n" \ - " return thisResult;\n" \ - " };\n" \ - " } else if (this._pendingRead) {\n" \ - " var read = this._pendingRead;\n" \ - " this._pendingRead = @undefined;\n" \ - " @putByIdDirectPrivate(this, \"pull\", @noopDoneFunction);\n" \ - " @fulfillPromise(read, { value: @undefined, done: true });\n" \ - " }\n" \ - "\n" \ - " @readableStreamClose(stream);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsOnFlushDirectStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsOnFlushDirectStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsOnFlushDirectStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsOnFlushDirectStreamCodeLength = 929; -static const JSC::Intrinsic s_readableStreamInternalsOnFlushDirectStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsOnFlushDirectStreamCode = - "(function () {\n" \ - " \"use strict\";\n" \ - "\n" \ - " var stream = this.@controlledReadableStream;\n" \ - " var reader = @getByIdDirectPrivate(stream, \"reader\");\n" \ - " if (!reader || !@isReadableStreamDefaultReader(reader)) {\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " var _pendingRead = this._pendingRead;\n" \ - " this._pendingRead = @undefined;\n" \ - " if (_pendingRead && @isPromise(_pendingRead)) {\n" \ - " var flushed = this.@sink.flush();\n" \ - " if (flushed?.byteLength) {\n" \ - " this._pendingRead = @getByIdDirectPrivate(\n" \ - " stream,\n" \ - " \"readRequests\"\n" \ - " )?.shift();\n" \ - " @fulfillPromise(_pendingRead, { value: flushed, done: false });\n" \ - " } else {\n" \ - " this._pendingRead = _pendingRead;\n" \ - " }\n" \ - " } else if (@getByIdDirectPrivate(stream, \"readRequests\")?.isNotEmpty()) {\n" \ - " var flushed = this.@sink.flush();\n" \ - " if (flushed?.byteLength) {\n" \ - " @readableStreamFulfillReadRequest(stream, flushed, false);\n" \ - " }\n" \ - " } else if (this._deferFlush === -1) {\n" \ - " this._deferFlush = 1;\n" \ - " }\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsCreateTextStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsCreateTextStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsCreateTextStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsCreateTextStreamCodeLength = 2373; -static const JSC::Intrinsic s_readableStreamInternalsCreateTextStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsCreateTextStreamCode = - "(function (highWaterMark) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " var sink;\n" \ - " var array = [];\n" \ - " var hasString = false;\n" \ - " var hasBuffer = false;\n" \ - " var rope = \"\";\n" \ - " var estimatedLength = @toLength(0);\n" \ - " var capability = @newPromiseCapability(@Promise);\n" \ - " var calledDone = false;\n" \ - "\n" \ - " sink = {\n" \ - " start() {},\n" \ - " write(chunk) {\n" \ - " if (typeof chunk === \"string\") {\n" \ - " var chunkLength = @toLength(chunk.length);\n" \ - " if (chunkLength > 0) {\n" \ - " rope += chunk;\n" \ - " hasString = true;\n" \ - " //\n" \ - " estimatedLength += chunkLength;\n" \ - " }\n" \ - "\n" \ - " return chunkLength;\n" \ - " }\n" \ - "\n" \ - " if (\n" \ - " !chunk ||\n" \ - " !(@ArrayBuffer.@isView(chunk) || chunk instanceof @ArrayBuffer)\n" \ - " ) {\n" \ - " @throwTypeError(\"Expected text, ArrayBuffer or ArrayBufferView\");\n" \ - " }\n" \ - "\n" \ - " const byteLength = @toLength(chunk.byteLength);\n" \ - " if (byteLength > 0) {\n" \ - " hasBuffer = true;\n" \ - " if (rope.length > 0) {\n" \ - " @arrayPush(array, rope, chunk);\n" \ - " rope = \"\";\n" \ - " } else {\n" \ - " @arrayPush(array, chunk);\n" \ - " }\n" \ - " }\n" \ - " estimatedLength += byteLength;\n" \ - " return byteLength;\n" \ - " },\n" \ - "\n" \ - " flush() {\n" \ - " return 0;\n" \ - " },\n" \ - "\n" \ - " end() {\n" \ - " if (calledDone) {\n" \ - " return \"\";\n" \ - " }\n" \ - " return sink.fulfill();\n" \ - " },\n" \ - "\n" \ - " fulfill() {\n" \ - " calledDone = true;\n" \ - " const result = sink.finishInternal();\n" \ - "\n" \ - " @fulfillPromise(capability.@promise, result);\n" \ - " return result;\n" \ - " },\n" \ - "\n" \ - " finishInternal() {\n" \ - " if (!hasString && !hasBuffer) {\n" \ - " return \"\";\n" \ - " }\n" \ - "\n" \ - " if (hasString && !hasBuffer) {\n" \ - " return rope;\n" \ - " }\n" \ - "\n" \ - " if (hasBuffer && !hasString) {\n" \ - " return new globalThis.TextDecoder().decode(\n" \ - " @Bun.concatArrayBuffers(array)\n" \ - " );\n" \ - " }\n" \ - "\n" \ - " //\n" \ - "\n" \ - " var arrayBufferSink = new @Bun.ArrayBufferSink();\n" \ - " arrayBufferSink.start({\n" \ - " highWaterMark: estimatedLength,\n" \ - " asUint8Array: true,\n" \ - " });\n" \ - " for (let item of array) {\n" \ - " arrayBufferSink.write(item);\n" \ - " }\n" \ - " array.length = 0;\n" \ - " if (rope.length > 0) {\n" \ - " arrayBufferSink.write(rope);\n" \ - " rope = \"\";\n" \ - " }\n" \ - "\n" \ - " //\n" \ - " return new globalThis.TextDecoder().decode(arrayBufferSink.end());\n" \ - " },\n" \ - "\n" \ - " close() {\n" \ - " try {\n" \ - " if (!calledDone) {\n" \ - " calledDone = true;\n" \ - " sink.fulfill();\n" \ - " }\n" \ - " } catch (e) {}\n" \ - " },\n" \ - " };\n" \ - "\n" \ - " return [sink, capability];\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsInitializeTextStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsInitializeTextStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsInitializeTextStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsInitializeTextStreamCodeLength = 822; -static const JSC::Intrinsic s_readableStreamInternalsInitializeTextStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsInitializeTextStreamCode = - "(function (underlyingSource, highWaterMark) {\n" \ - " \"use strict\";\n" \ - " var [sink, closingPromise] = @createTextStream(highWaterMark);\n" \ - "\n" \ - " var controller = {\n" \ - " @underlyingSource: underlyingSource,\n" \ - " @pull: @onPullDirectStream,\n" \ - " @controlledReadableStream: this,\n" \ - " @sink: sink,\n" \ - " close: @onCloseDirectStream,\n" \ - " write: sink.write,\n" \ - " error: @handleDirectStreamError,\n" \ - " end: @onCloseDirectStream,\n" \ - " @close: @onCloseDirectStream,\n" \ - " flush: @onFlushDirectStream,\n" \ - " _pendingRead: @undefined,\n" \ - " _deferClose: 0,\n" \ - " _deferFlush: 0,\n" \ - " _deferCloseReason: @undefined,\n" \ - " _handleError: @undefined,\n" \ - " };\n" \ - "\n" \ - " @putByIdDirectPrivate(this, \"readableStreamController\", controller);\n" \ - " @putByIdDirectPrivate(this, \"underlyingSource\", @undefined);\n" \ - " @putByIdDirectPrivate(this, \"start\", @undefined);\n" \ - " return closingPromise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsInitializeArrayStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsInitializeArrayStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsInitializeArrayStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsInitializeArrayStreamCodeLength = 1330; -static const JSC::Intrinsic s_readableStreamInternalsInitializeArrayStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsInitializeArrayStreamCode = - "(function (underlyingSource, highWaterMark) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " var array = [];\n" \ - " var closingPromise = @newPromiseCapability(@Promise);\n" \ - " var calledDone = false;\n" \ - "\n" \ - " function fulfill() {\n" \ - " calledDone = true;\n" \ - " closingPromise.@resolve.@call(@undefined, array);\n" \ - " return array;\n" \ - " }\n" \ - "\n" \ - " var sink = {\n" \ - " start() {},\n" \ - " write(chunk) {\n" \ - " @arrayPush(array, chunk);\n" \ - " return chunk.byteLength || chunk.length;\n" \ - " },\n" \ - "\n" \ - " flush() {\n" \ - " return 0;\n" \ - " },\n" \ - "\n" \ - " end() {\n" \ - " if (calledDone) {\n" \ - " return [];\n" \ - " }\n" \ - " return fulfill();\n" \ - " },\n" \ - "\n" \ - " close() {\n" \ - " if (!calledDone) {\n" \ - " fulfill();\n" \ - " }\n" \ - " },\n" \ - " };\n" \ - "\n" \ - " var controller = {\n" \ - " @underlyingSource: underlyingSource,\n" \ - " @pull: @onPullDirectStream,\n" \ - " @controlledReadableStream: this,\n" \ - " @sink: sink,\n" \ - " close: @onCloseDirectStream,\n" \ - " write: sink.write,\n" \ - " error: @handleDirectStreamError,\n" \ - " end: @onCloseDirectStream,\n" \ - " @close: @onCloseDirectStream,\n" \ - " flush: @onFlushDirectStream,\n" \ - " _pendingRead: @undefined,\n" \ - " _deferClose: 0,\n" \ - " _deferFlush: 0,\n" \ - " _deferCloseReason: @undefined,\n" \ - " _handleError: @undefined,\n" \ - " };\n" \ - "\n" \ - " @putByIdDirectPrivate(this, \"readableStreamController\", controller);\n" \ - " @putByIdDirectPrivate(this, \"underlyingSource\", @undefined);\n" \ - " @putByIdDirectPrivate(this, \"start\", @undefined);\n" \ - " return closingPromise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsInitializeArrayBufferStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsInitializeArrayBufferStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsInitializeArrayBufferStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsInitializeArrayBufferStreamCodeLength = 995; -static const JSC::Intrinsic s_readableStreamInternalsInitializeArrayBufferStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsInitializeArrayBufferStreamCode = - "(function (underlyingSource, highWaterMark) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - "\n" \ - " var opts =\n" \ - " highWaterMark && typeof highWaterMark === \"number\"\n" \ - " ? { highWaterMark, stream: true, asUint8Array: true }\n" \ - " : { stream: true, asUint8Array: true };\n" \ - " var sink = new @Bun.ArrayBufferSink();\n" \ - " sink.start(opts);\n" \ - "\n" \ - " var controller = {\n" \ - " @underlyingSource: underlyingSource,\n" \ - " @pull: @onPullDirectStream,\n" \ - " @controlledReadableStream: this,\n" \ - " @sink: sink,\n" \ - " close: @onCloseDirectStream,\n" \ - " write: sink.write.bind(sink),\n" \ - " error: @handleDirectStreamError,\n" \ - " end: @onCloseDirectStream,\n" \ - " @close: @onCloseDirectStream,\n" \ - " flush: @onFlushDirectStream,\n" \ - " _pendingRead: @undefined,\n" \ - " _deferClose: 0,\n" \ - " _deferFlush: 0,\n" \ - " _deferCloseReason: @undefined,\n" \ - " _handleError: @undefined,\n" \ - " };\n" \ - "\n" \ - " @putByIdDirectPrivate(this, \"readableStreamController\", controller);\n" \ - " @putByIdDirectPrivate(this, \"underlyingSource\", @undefined);\n" \ - " @putByIdDirectPrivate(this, \"start\", @undefined);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamErrorCodeLength = 1212; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamErrorCode = - "(function (stream, error) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@isReadableStream(stream));\n" \ - " @assert(@getByIdDirectPrivate(stream, \"state\") === @streamReadable);\n" \ - " @putByIdDirectPrivate(stream, \"state\", @streamErrored);\n" \ - " @putByIdDirectPrivate(stream, \"storedError\", error);\n" \ - "\n" \ - " const reader = @getByIdDirectPrivate(stream, \"reader\");\n" \ - "\n" \ - " if (!reader) return;\n" \ - "\n" \ - " if (@isReadableStreamDefaultReader(reader)) {\n" \ - " const requests = @getByIdDirectPrivate(reader, \"readRequests\");\n" \ - " @putByIdDirectPrivate(reader, \"readRequests\", @createFIFO());\n" \ - " for (var request = requests.shift(); request; request = requests.shift())\n" \ - " @rejectPromise(request, error);\n" \ - " } else {\n" \ - " @assert(@isReadableStreamBYOBReader(reader));\n" \ - " const requests = @getByIdDirectPrivate(reader, \"readIntoRequests\");\n" \ - " @putByIdDirectPrivate(reader, \"readIntoRequests\", @createFIFO());\n" \ - " for (var request = requests.shift(); request; request = requests.shift())\n" \ - " @rejectPromise(request, error);\n" \ - " }\n" \ - "\n" \ - " @getByIdDirectPrivate(reader, \"closedPromiseCapability\").@reject.@call(\n" \ - " @undefined,\n" \ - " error\n" \ - " );\n" \ - " const promise = @getByIdDirectPrivate(\n" \ - " reader,\n" \ - " \"closedPromiseCapability\"\n" \ - " ).@promise;\n" \ - " @markPromiseAsHandled(promise);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeLength = 700; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCode = - "(function (controller) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n" \ - "\n" \ - " if (!@readableStreamDefaultControllerCanCloseOrEnqueue(controller))\n" \ - " return false;\n" \ - " if (!(@getByIdDirectPrivate(controller, \"started\") === 1)) return false;\n" \ - " if (\n" \ - " (!@isReadableStreamLocked(stream) ||\n" \ - " !@getByIdDirectPrivate(\n" \ - " @getByIdDirectPrivate(stream, \"reader\"),\n" \ - " \"readRequests\"\n" \ - " )?.isNotEmpty()) &&\n" \ - " @readableStreamDefaultControllerGetDesiredSize(controller) <= 0\n" \ - " )\n" \ - " return false;\n" \ - " const desiredSize =\n" \ - " @readableStreamDefaultControllerGetDesiredSize(controller);\n" \ - " @assert(desiredSize !== null);\n" \ - " return desiredSize > 0;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeLength = 1277; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCode = - "(function (controller) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " //\n" \ - " const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n" \ - "\n" \ - " if (!@readableStreamDefaultControllerCanCloseOrEnqueue(controller)) return;\n" \ - " if (!(@getByIdDirectPrivate(controller, \"started\") === 1)) return;\n" \ - " if (\n" \ - " (!@isReadableStreamLocked(stream) ||\n" \ - " !@getByIdDirectPrivate(\n" \ - " @getByIdDirectPrivate(stream, \"reader\"),\n" \ - " \"readRequests\"\n" \ - " )?.isNotEmpty()) &&\n" \ - " @readableStreamDefaultControllerGetDesiredSize(controller) <= 0\n" \ - " )\n" \ - " return;\n" \ - "\n" \ - " if (@getByIdDirectPrivate(controller, \"pulling\")) {\n" \ - " @putByIdDirectPrivate(controller, \"pullAgain\", true);\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " @assert(!@getByIdDirectPrivate(controller, \"pullAgain\"));\n" \ - " @putByIdDirectPrivate(controller, \"pulling\", true);\n" \ - "\n" \ - " @getByIdDirectPrivate(controller, \"pullAlgorithm\")\n" \ - " .@call(@undefined)\n" \ - " .@then(\n" \ - " function () {\n" \ - " @putByIdDirectPrivate(controller, \"pulling\", false);\n" \ - " if (@getByIdDirectPrivate(controller, \"pullAgain\")) {\n" \ - " @putByIdDirectPrivate(controller, \"pullAgain\", false);\n" \ - "\n" \ - " @readableStreamDefaultControllerCallPullIfNeeded(controller);\n" \ - " }\n" \ - " },\n" \ - " function (error) {\n" \ - " @readableStreamDefaultControllerError(controller, error);\n" \ - " }\n" \ - " );\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamLockedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamLockedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsIsReadableStreamLockedCodeLength = 131; -static const JSC::Intrinsic s_readableStreamInternalsIsReadableStreamLockedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsIsReadableStreamLockedCode = - "(function (stream) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@isReadableStream(stream));\n" \ - " return !!@getByIdDirectPrivate(stream, \"reader\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeLength = 403; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCode = - "(function (controller) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - "\n" \ - " if (state === @streamErrored) return null;\n" \ - " if (state === @streamClosed) return 0;\n" \ - "\n" \ - " return (\n" \ - " @getByIdDirectPrivate(controller, \"strategy\").highWaterMark -\n" \ - " @getByIdDirectPrivate(controller, \"queue\").size\n" \ - " );\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamReaderGenericCancelCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamReaderGenericCancelCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamReaderGenericCancelCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamReaderGenericCancelCodeLength = 189; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamReaderGenericCancelCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamReaderGenericCancelCode = - "(function (reader, reason) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(reader, \"ownerReadableStream\");\n" \ - " @assert(!!stream);\n" \ - " return @readableStreamCancel(stream, reason);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamCancelCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamCancelCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamCancelCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamCancelCodeLength = 736; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamCancelCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamCancelCode = - "(function (stream, reason) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"disturbed\", true);\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - " if (state === @streamClosed) return @Promise.@resolve();\n" \ - " if (state === @streamErrored)\n" \ - " return @Promise.@reject(@getByIdDirectPrivate(stream, \"storedError\"));\n" \ - " @readableStreamClose(stream);\n" \ - "\n" \ - " var controller = @getByIdDirectPrivate(stream, \"readableStreamController\");\n" \ - " var cancel = controller.@cancel;\n" \ - " if (cancel) {\n" \ - " return cancel(controller, reason).@then(function () {});\n" \ - " }\n" \ - "\n" \ - " var close = controller.close;\n" \ - " if (close) {\n" \ - " return @Promise.@resolve(controller.close(reason));\n" \ - " }\n" \ - "\n" \ - " @throwTypeError(\"ReadableStreamController has no cancel or close method\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeLength = 213; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerCancelCode = - "(function (controller, reason) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " @putByIdDirectPrivate(controller, \"queue\", @newQueue());\n" \ - " return @getByIdDirectPrivate(controller, \"cancelAlgorithm\").@call(\n" \ - " @undefined,\n" \ - " reason\n" \ - " );\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerPullCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerPullCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerPullCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerPullCodeLength = 751; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerPullCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerPullCode = - "(function (controller) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " var queue = @getByIdDirectPrivate(controller, \"queue\");\n" \ - " if (queue.content.isNotEmpty()) {\n" \ - " const chunk = @dequeueValue(queue);\n" \ - " if (\n" \ - " @getByIdDirectPrivate(controller, \"closeRequested\") &&\n" \ - " queue.content.isEmpty()\n" \ - " )\n" \ - " @readableStreamClose(\n" \ - " @getByIdDirectPrivate(controller, \"controlledReadableStream\")\n" \ - " );\n" \ - " else @readableStreamDefaultControllerCallPullIfNeeded(controller);\n" \ - "\n" \ - " return @createFulfilledPromise({ value: chunk, done: false });\n" \ - " }\n" \ - " const pendingPromise = @readableStreamAddReadRequest(\n" \ - " @getByIdDirectPrivate(controller, \"controlledReadableStream\")\n" \ - " );\n" \ - " @readableStreamDefaultControllerCallPullIfNeeded(controller);\n" \ - " return pendingPromise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeLength = 351; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerCloseCode = - "(function (controller) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@readableStreamDefaultControllerCanCloseOrEnqueue(controller));\n" \ - " @putByIdDirectPrivate(controller, \"closeRequested\", true);\n" \ - " if (@getByIdDirectPrivate(controller, \"queue\")?.content?.isEmpty())\n" \ - " @readableStreamClose(\n" \ - " @getByIdDirectPrivate(controller, \"controlledReadableStream\")\n" \ - " );\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamCloseCodeLength = 883; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamCloseCode = - "(function (stream) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@getByIdDirectPrivate(stream, \"state\") === @streamReadable);\n" \ - " @putByIdDirectPrivate(stream, \"state\", @streamClosed);\n" \ - " if (!@getByIdDirectPrivate(stream, \"reader\")) return;\n" \ - "\n" \ - " if (\n" \ - " @isReadableStreamDefaultReader(@getByIdDirectPrivate(stream, \"reader\"))\n" \ - " ) {\n" \ - " const requests = @getByIdDirectPrivate(\n" \ - " @getByIdDirectPrivate(stream, \"reader\"),\n" \ - " \"readRequests\"\n" \ - " );\n" \ - " if (requests.isNotEmpty()) {\n" \ - " @putByIdDirectPrivate(\n" \ - " @getByIdDirectPrivate(stream, \"reader\"),\n" \ - " \"readRequests\",\n" \ - " @createFIFO()\n" \ - " );\n" \ - "\n" \ - " for (var request = requests.shift(); request; request = requests.shift())\n" \ - " @fulfillPromise(request, { value: @undefined, done: true });\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " @getByIdDirectPrivate(\n" \ - " @getByIdDirectPrivate(stream, \"reader\"),\n" \ - " \"closedPromiseCapability\"\n" \ - " ).@resolve.@call();\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamFulfillReadRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamFulfillReadRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamFulfillReadRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamFulfillReadRequestCodeLength = 237; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamFulfillReadRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamFulfillReadRequestCode = - "(function (stream, chunk, done) {\n" \ - " \"use strict\";\n" \ - " const readRequest = @getByIdDirectPrivate(\n" \ - " @getByIdDirectPrivate(stream, \"reader\"),\n" \ - " \"readRequests\"\n" \ - " ).shift();\n" \ - " @fulfillPromise(readRequest, { value: chunk, done: done });\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeLength = 986; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCode = - "(function (controller, chunk) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(controller, \"controlledReadableStream\");\n" \ - " //\n" \ - " @assert(@readableStreamDefaultControllerCanCloseOrEnqueue(controller));\n" \ - "\n" \ - " if (\n" \ - " @isReadableStreamLocked(stream) &&\n" \ - " @getByIdDirectPrivate(\n" \ - " @getByIdDirectPrivate(stream, \"reader\"),\n" \ - " \"readRequests\"\n" \ - " )?.isNotEmpty()\n" \ - " ) {\n" \ - " @readableStreamFulfillReadRequest(stream, chunk, false);\n" \ - " @readableStreamDefaultControllerCallPullIfNeeded(controller);\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " try {\n" \ - " let chunkSize = 1;\n" \ - " if (@getByIdDirectPrivate(controller, \"strategy\").size !== @undefined)\n" \ - " chunkSize = @getByIdDirectPrivate(controller, \"strategy\").size(chunk);\n" \ - " @enqueueValueWithSize(\n" \ - " @getByIdDirectPrivate(controller, \"queue\"),\n" \ - " chunk,\n" \ - " chunkSize\n" \ - " );\n" \ - " } catch (error) {\n" \ - " @readableStreamDefaultControllerError(controller, error);\n" \ - " throw error;\n" \ - " }\n" \ - " @readableStreamDefaultControllerCallPullIfNeeded(controller);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultReaderReadCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultReaderReadCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultReaderReadCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultReaderReadCodeLength = 631; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultReaderReadCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultReaderReadCode = - "(function (reader) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(reader, \"ownerReadableStream\");\n" \ - " @assert(!!stream);\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"disturbed\", true);\n" \ - " if (state === @streamClosed)\n" \ - " return @createFulfilledPromise({ value: @undefined, done: true });\n" \ - " if (state === @streamErrored)\n" \ - " return @Promise.@reject(@getByIdDirectPrivate(stream, \"storedError\"));\n" \ - " @assert(state === @streamReadable);\n" \ - "\n" \ - " return @getByIdDirectPrivate(stream, \"readableStreamController\").@pull(\n" \ - " @getByIdDirectPrivate(stream, \"readableStreamController\")\n" \ - " );\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamAddReadRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamAddReadRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamAddReadRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamAddReadRequestCodeLength = 377; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamAddReadRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamAddReadRequestCode = - "(function (stream) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(\n" \ - " @isReadableStreamDefaultReader(@getByIdDirectPrivate(stream, \"reader\"))\n" \ - " );\n" \ - " @assert(@getByIdDirectPrivate(stream, \"state\") == @streamReadable);\n" \ - "\n" \ - " const readRequest = @newPromise();\n" \ - "\n" \ - " @getByIdDirectPrivate(\n" \ - " @getByIdDirectPrivate(stream, \"reader\"),\n" \ - " \"readRequests\"\n" \ - " ).push(readRequest);\n" \ - "\n" \ - " return readRequest;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamDisturbedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamDisturbedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamDisturbedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsIsReadableStreamDisturbedCodeLength = 132; -static const JSC::Intrinsic s_readableStreamInternalsIsReadableStreamDisturbedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsIsReadableStreamDisturbedCode = - "(function (stream) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@isReadableStream(stream));\n" \ - " return @getByIdDirectPrivate(stream, \"disturbed\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeLength = 1083; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamReaderGenericReleaseCode = - "(function (reader) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(!!@getByIdDirectPrivate(reader, \"ownerReadableStream\"));\n" \ - " @assert(\n" \ - " @getByIdDirectPrivate(\n" \ - " @getByIdDirectPrivate(reader, \"ownerReadableStream\"),\n" \ - " \"reader\"\n" \ - " ) === reader\n" \ - " );\n" \ - "\n" \ - " if (\n" \ - " @getByIdDirectPrivate(\n" \ - " @getByIdDirectPrivate(reader, \"ownerReadableStream\"),\n" \ - " \"state\"\n" \ - " ) === @streamReadable\n" \ - " )\n" \ - " @getByIdDirectPrivate(reader, \"closedPromiseCapability\").@reject.@call(\n" \ - " @undefined,\n" \ - " @makeTypeError(\n" \ - " \"releasing lock of reader whose stream is still in readable state\"\n" \ - " )\n" \ - " );\n" \ - " else\n" \ - " @putByIdDirectPrivate(reader, \"closedPromiseCapability\", {\n" \ - " @promise: @newHandledRejectedPromise(\n" \ - " @makeTypeError(\"reader released lock\")\n" \ - " ),\n" \ - " });\n" \ - "\n" \ - " const promise = @getByIdDirectPrivate(\n" \ - " reader,\n" \ - " \"closedPromiseCapability\"\n" \ - " ).@promise;\n" \ - " @markPromiseAsHandled(promise);\n" \ - " @putByIdDirectPrivate(\n" \ - " @getByIdDirectPrivate(reader, \"ownerReadableStream\"),\n" \ - " \"reader\",\n" \ - " @undefined\n" \ - " );\n" \ - " @putByIdDirectPrivate(reader, \"ownerReadableStream\", @undefined);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeLength = 257; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCode = - "(function (controller) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " return (\n" \ - " !@getByIdDirectPrivate(controller, \"closeRequested\") &&\n" \ - " @getByIdDirectPrivate(\n" \ - " @getByIdDirectPrivate(controller, \"controlledReadableStream\"),\n" \ - " \"state\"\n" \ - " ) === @streamReadable\n" \ - " );\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsLazyLoadStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsLazyLoadStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsLazyLoadStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsLazyLoadStreamCodeLength = 3983; -static const JSC::Intrinsic s_readableStreamInternalsLazyLoadStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsLazyLoadStreamCode = - "(function (stream, autoAllocateChunkSize) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " var nativeType = @getByIdDirectPrivate(stream, \"bunNativeType\");\n" \ - " var nativePtr = @getByIdDirectPrivate(stream, \"bunNativePtr\");\n" \ - " var Prototype = @lazyStreamPrototypeMap.@get(nativeType);\n" \ - " if (Prototype === @undefined) {\n" \ - " var [pull, start, cancel, setClose, deinit, setRefOrUnref, drain] = @lazyLoad(nativeType);\n" \ - " var closer = [false];\n" \ - " var handleResult;\n" \ - " function handleNativeReadableStreamPromiseResult(val) {\n" \ - " \"use strict\";\n" \ - " var { c, v } = this;\n" \ - " this.c = @undefined;\n" \ - " this.v = @undefined;\n" \ - " handleResult(val, c, v);\n" \ - " }\n" \ - "\n" \ - " function callClose(controller) {\n" \ - " try {\n" \ - " controller.close();\n" \ - " } catch(e) {\n" \ - " globalThis.reportError(e);\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " handleResult = function handleResult(result, controller, view) {\n" \ - " \"use strict\";\n" \ - " if (result && @isPromise(result)) {\n" \ - " return result.then(\n" \ - " handleNativeReadableStreamPromiseResult.bind({\n" \ - " c: controller,\n" \ - " v: view,\n" \ - " }),\n" \ - " (err) => controller.error(err)\n" \ - " );\n" \ - " } else if (typeof result === 'number') {\n" \ - " if (view && view.byteLength === result && view.buffer === controller.byobRequest?.view?.buffer) {\n" \ - " controller.byobRequest.respondWithNewView(view);\n" \ - " } else {\n" \ - " controller.byobRequest.respond(result);\n" \ - " }\n" \ - " } else if (result.constructor === @Uint8Array) {\n" \ - " controller.enqueue(result);\n" \ - " }\n" \ - "\n" \ - " if (closer[0] || result === false) {\n" \ - " @enqueueJob(callClose, controller);\n" \ - " closer[0] = false;\n" \ - " }\n" \ - " };\n" \ - "\n" \ - " function createResult(tag, controller, view, closer) {\n" \ - " closer[0] = false;\n" \ - "\n" \ - " var result;\n" \ - " try {\n" \ - " result = pull(tag, view, closer);\n" \ - " } catch (err) {\n" \ - " return controller.error(err);\n" \ - " }\n" \ - "\n" \ - " return handleResult(result, controller, view);\n" \ - " }\n" \ - "\n" \ - " const registry = deinit ? new FinalizationRegistry(deinit) : null;\n" \ - " Prototype = class NativeReadableStreamSource {\n" \ - " constructor(tag, autoAllocateChunkSize, drainValue) {\n" \ - " this.#tag = tag;\n" \ - " this.#cancellationToken = {};\n" \ - " this.pull = this.#pull.bind(this);\n" \ - " this.cancel = this.#cancel.bind(this);\n" \ - " this.autoAllocateChunkSize = autoAllocateChunkSize;\n" \ - "\n" \ - " if (drainValue !== @undefined) {\n" \ - " this.start = (controller) => {\n" \ - " controller.enqueue(drainValue);\n" \ - " };\n" \ - " }\n" \ - "\n" \ - " if (registry) {\n" \ - " registry.register(this, tag, this.#cancellationToken);\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " #cancellationToken;\n" \ - " pull;\n" \ - " cancel;\n" \ - " start;\n" \ - "\n" \ - " #tag;\n" \ - " type = \"bytes\";\n" \ - " autoAllocateChunkSize = 0;\n" \ - " \n" \ - " static startSync = start;\n" \ - " \n" \ - " \n" \ - " #pull(controller) {\n" \ - " var tag = this.#tag;\n" \ - "\n" \ - " if (!tag) {\n" \ - " controller.close();\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " createResult(tag, controller, controller.byobRequest.view, closer);\n" \ - " }\n" \ - "\n" \ - " #cancel(reason) {\n" \ - " var tag = this.#tag;\n" \ - "\n" \ - " registry && registry.unregister(this.#cancellationToken);\n" \ - " setRefOrUnref && setRefOrUnref(tag, false);\n" \ - " cancel(tag, reason);\n" \ - " }\n" \ - " static deinit = deinit;\n" \ - " static drain = drain;\n" \ - " };\n" \ - " @lazyStreamPrototypeMap.@set(nativeType, Prototype);\n" \ - " }\n" \ - "\n" \ - " const chunkSize = Prototype.startSync(nativePtr, autoAllocateChunkSize);\n" \ - " var drainValue;\n" \ - " const {drain: drainFn, deinit: deinitFn} = Prototype;\n" \ - " if (drainFn) {\n" \ - " drainValue = drainFn(nativePtr);\n" \ - " }\n" \ - "\n" \ - " //\n" \ - " if (chunkSize === 0) {\n" \ - " deinit && nativePtr && @enqueueJob(deinit, nativePtr);\n" \ - "\n" \ - " if ((drainValue?.byteLength ?? 0) > 0) {\n" \ - " return {\n" \ - " start(controller) {\n" \ - " controller.enqueue(drainValue);\n" \ - " controller.close();\n" \ - " },\n" \ - " type: \"bytes\",\n" \ - " };\n" \ - " }\n" \ - "\n" \ - " return {\n" \ - " start(controller) {\n" \ - " controller.close();\n" \ - " },\n" \ - " type: \"bytes\",\n" \ - " };\n" \ - " }\n" \ - "\n" \ - " return new Prototype(nativePtr, chunkSize, drainValue);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamIntoArrayCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamIntoArrayCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamIntoArrayCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamIntoArrayCodeLength = 578; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamIntoArrayCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamIntoArrayCode = - "(function (stream) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " var reader = stream.getReader();\n" \ - " var manyResult = reader.readMany();\n" \ - "\n" \ - " async function processManyResult(result) {\n" \ - " if (result.done) {\n" \ - " return [];\n" \ - " }\n" \ - "\n" \ - " var chunks = result.value || [];\n" \ - "\n" \ - " while (true) {\n" \ - " var thisResult = await reader.read();\n" \ - " if (thisResult.done) {\n" \ - " break;\n" \ - " }\n" \ - " chunks = chunks.concat(thisResult.value);\n" \ - " }\n" \ - "\n" \ - " return chunks;\n" \ - " }\n" \ - "\n" \ - " if (manyResult && @isPromise(manyResult)) {\n" \ - " return manyResult.@then(processManyResult);\n" \ - " }\n" \ - "\n" \ - " return processManyResult(manyResult);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamIntoTextCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamIntoTextCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamIntoTextCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamIntoTextCodeLength = 333; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamIntoTextCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamIntoTextCode = - "(function (stream) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " const [textStream, closer] = @createTextStream(\n" \ - " @getByIdDirectPrivate(stream, \"highWaterMark\")\n" \ - " );\n" \ - " const prom = @readStreamIntoSink(stream, textStream, false);\n" \ - " if (prom && @isPromise(prom)) {\n" \ - " return @Promise.@resolve(prom).@then(closer.@promise);\n" \ - " }\n" \ - " return closer.@promise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeLength = 1533; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamToArrayBufferDirectCode = - "(function (stream, underlyingSource) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " var sink = new @Bun.ArrayBufferSink();\n" \ - " @putByIdDirectPrivate(stream, \"underlyingSource\", @undefined);\n" \ - " var highWaterMark = @getByIdDirectPrivate(stream, \"highWaterMark\");\n" \ - " sink.start(highWaterMark ? { highWaterMark } : {});\n" \ - " var capability = @newPromiseCapability(@Promise);\n" \ - " var ended = false;\n" \ - " var pull = underlyingSource.pull;\n" \ - " var close = underlyingSource.close;\n" \ - "\n" \ - " var controller = {\n" \ - " start() {},\n" \ - " close(reason) {\n" \ - " if (!ended) {\n" \ - " ended = true;\n" \ - " if (close) {\n" \ - " close();\n" \ - " }\n" \ - "\n" \ - " @fulfillPromise(capability.@promise, sink.end());\n" \ - " }\n" \ - " },\n" \ - " end() {\n" \ - " if (!ended) {\n" \ - " ended = true;\n" \ - " if (close) {\n" \ - " close();\n" \ - " }\n" \ - " @fulfillPromise(capability.@promise, sink.end());\n" \ - " }\n" \ - " },\n" \ - " flush() {\n" \ - " return 0;\n" \ - " },\n" \ - " write: sink.write.bind(sink),\n" \ - " };\n" \ - "\n" \ - " var didError = false;\n" \ - " try {\n" \ - " const firstPull = pull(controller);\n" \ - " if (firstPull && @isObject(firstPull) && @isPromise(firstPull)) {\n" \ - " return (async function (controller, promise, pull) {\n" \ - " while (!ended) {\n" \ - " await pull(controller);\n" \ - " }\n" \ - " return await promise;\n" \ - " })(controller, promise, pull);\n" \ - " }\n" \ - "\n" \ - " return capability.@promise;\n" \ - " } catch (e) {\n" \ - " didError = true;\n" \ - " @readableStreamError(stream, e);\n" \ - " return @Promise.@reject(e);\n" \ - " } finally {\n" \ - " if (!didError && stream) @readableStreamClose(stream);\n" \ - " controller = close = sink = pull = stream = @undefined;\n" \ - " }\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamToTextDirectCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamToTextDirectCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamToTextDirectCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamToTextDirectCodeLength = 496; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamToTextDirectCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamToTextDirectCode = - "(async function (stream, underlyingSource) {\n" \ - " \"use strict\";\n" \ - " const capability = @initializeTextStream.@call(\n" \ - " stream,\n" \ - " underlyingSource,\n" \ - " @undefined\n" \ - " );\n" \ - " var reader = stream.getReader();\n" \ - "\n" \ - " while (@getByIdDirectPrivate(stream, \"state\") === @streamReadable) {\n" \ - " var thisResult = await reader.read();\n" \ - " if (thisResult.done) {\n" \ - " break;\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " try {\n" \ - " reader.releaseLock();\n" \ - " } catch (e) {}\n" \ - " reader = @undefined;\n" \ - " stream = @undefined;\n" \ - "\n" \ - " return capability.@promise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamToArrayDirectCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamToArrayDirectCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamToArrayDirectCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamToArrayDirectCodeLength = 667; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamToArrayDirectCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamToArrayDirectCode = - "(async function (stream, underlyingSource) {\n" \ - " const capability = @initializeArrayStream.@call(\n" \ - " stream,\n" \ - " underlyingSource,\n" \ - " @undefined\n" \ - " );\n" \ - " underlyingSource = @undefined;\n" \ - " var reader = stream.getReader();\n" \ - " try {\n" \ - " while (@getByIdDirectPrivate(stream, \"state\") === @streamReadable) {\n" \ - " var thisResult = await reader.read();\n" \ - " if (thisResult.done) {\n" \ - " break;\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " try {\n" \ - " reader.releaseLock();\n" \ - " } catch (e) {}\n" \ - " reader = @undefined;\n" \ - "\n" \ - " return @Promise.@resolve(capability.@promise);\n" \ - " } catch (e) {\n" \ - " throw e;\n" \ - " } finally {\n" \ - " stream = @undefined;\n" \ - " reader = @undefined;\n" \ - " }\n" \ - "\n" \ - " return capability.@promise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeLength = 1478; -static const JSC::Intrinsic s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_readableStreamInternalsReadableStreamDefineLazyIteratorsCode = - "(function (prototype) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " var asyncIterator = globalThis.Symbol.asyncIterator;\n" \ - "\n" \ - " var ReadableStreamAsyncIterator = async function* ReadableStreamAsyncIterator(stream, preventCancel) {\n" \ - " var reader = stream.getReader();\n" \ - " var deferredError;\n" \ - " try {\n" \ - " while (true) {\n" \ - " var done, value;\n" \ - " const firstResult = reader.readMany();\n" \ - " if (@isPromise(firstResult)) {\n" \ - " ({done, value} = await firstResult);\n" \ - " } else {\n" \ - " ({done, value} = firstResult);\n" \ - " }\n" \ - "\n" \ - " if (done) {\n" \ - " return;\n" \ - " }\n" \ - " yield* value;\n" \ - " }\n" \ - " } catch(e) {\n" \ - " deferredError = e;\n" \ - " } finally {\n" \ - " reader.releaseLock();\n" \ - "\n" \ - " if (!preventCancel) {\n" \ - " stream.cancel(deferredError);\n" \ - " }\n" \ - "\n" \ - " if (deferredError) {\n" \ - " throw deferredError;\n" \ - " }\n" \ - " }\n" \ - " };\n" \ - " var createAsyncIterator = function asyncIterator() {\n" \ - " return ReadableStreamAsyncIterator(this, false);\n" \ - " };\n" \ - " var createValues = function values({preventCancel = false} = {preventCancel: false}) {\n" \ - " return ReadableStreamAsyncIterator(this, preventCancel);\n" \ - " };\n" \ - " @Object.@defineProperty(prototype, asyncIterator, { value: createAsyncIterator });\n" \ - " @Object.@defineProperty(prototype, \"values\", { value: createValues });\n" \ - " return prototype;\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().readableStreamInternalsBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().readableStreamInternalsBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.h b/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.h deleted file mode 100644 index d34758e0b..000000000 --- a/src/bun.js/builtins/cpp/ReadableStreamInternalsBuiltins.h +++ /dev/null @@ -1,732 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* ReadableStreamInternals */ -extern const char* const s_readableStreamInternalsReadableStreamReaderGenericInitializeCode; -extern const int s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCode; -extern const int s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerErrorCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamPipeToCode; -extern const int s_readableStreamInternalsReadableStreamPipeToCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamPipeToCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamPipeToCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamPipeToCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsAcquireReadableStreamDefaultReaderCode; -extern const int s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsSetupReadableStreamDefaultControllerCode; -extern const int s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsCreateReadableStreamControllerCode; -extern const int s_readableStreamInternalsCreateReadableStreamControllerCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsCreateReadableStreamControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsCreateReadableStreamControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsCreateReadableStreamControllerCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerStartCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerStartCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerStartCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerStartCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerStartCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamPipeToWritableStreamCode; -extern const int s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsPipeToLoopCode; -extern const int s_readableStreamInternalsPipeToLoopCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPipeToLoopCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPipeToLoopCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPipeToLoopCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsPipeToDoReadWriteCode; -extern const int s_readableStreamInternalsPipeToDoReadWriteCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPipeToDoReadWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPipeToDoReadWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPipeToDoReadWriteCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCode; -extern const int s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCode; -extern const int s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCode; -extern const int s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCode; -extern const int s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsPipeToShutdownWithActionCode; -extern const int s_readableStreamInternalsPipeToShutdownWithActionCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPipeToShutdownWithActionCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPipeToShutdownWithActionCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPipeToShutdownWithActionCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsPipeToShutdownCode; -extern const int s_readableStreamInternalsPipeToShutdownCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPipeToShutdownCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPipeToShutdownCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPipeToShutdownCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsPipeToFinalizeCode; -extern const int s_readableStreamInternalsPipeToFinalizeCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsPipeToFinalizeCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsPipeToFinalizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsPipeToFinalizeCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamTeeCode; -extern const int s_readableStreamInternalsReadableStreamTeeCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeeCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeeCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamTeePullFunctionCode; -extern const int s_readableStreamInternalsReadableStreamTeePullFunctionCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeePullFunctionCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeePullFunctionCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeePullFunctionCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCode; -extern const int s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCode; -extern const int s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsIsReadableStreamCode; -extern const int s_readableStreamInternalsIsReadableStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsIsReadableStreamDefaultReaderCode; -extern const int s_readableStreamInternalsIsReadableStreamDefaultReaderCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamDefaultReaderCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamDefaultReaderCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamDefaultReaderCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsIsReadableStreamDefaultControllerCode; -extern const int s_readableStreamInternalsIsReadableStreamDefaultControllerCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamDefaultControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamDefaultControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamDefaultControllerCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadDirectStreamCode; -extern const int s_readableStreamInternalsReadDirectStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadDirectStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadDirectStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadDirectStreamCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsAssignToStreamCode; -extern const int s_readableStreamInternalsAssignToStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsAssignToStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsAssignToStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsAssignToStreamCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadStreamIntoSinkCode; -extern const int s_readableStreamInternalsReadStreamIntoSinkCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadStreamIntoSinkCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadStreamIntoSinkCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadStreamIntoSinkCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsHandleDirectStreamErrorCode; -extern const int s_readableStreamInternalsHandleDirectStreamErrorCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsHandleDirectStreamErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsHandleDirectStreamErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsHandleDirectStreamErrorCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsHandleDirectStreamErrorRejectCode; -extern const int s_readableStreamInternalsHandleDirectStreamErrorRejectCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsHandleDirectStreamErrorRejectCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsHandleDirectStreamErrorRejectCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsHandleDirectStreamErrorRejectCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsOnPullDirectStreamCode; -extern const int s_readableStreamInternalsOnPullDirectStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsOnPullDirectStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsOnPullDirectStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsOnPullDirectStreamCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsNoopDoneFunctionCode; -extern const int s_readableStreamInternalsNoopDoneFunctionCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsNoopDoneFunctionCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsNoopDoneFunctionCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsNoopDoneFunctionCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsOnReadableStreamDirectControllerClosedCode; -extern const int s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsOnCloseDirectStreamCode; -extern const int s_readableStreamInternalsOnCloseDirectStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsOnCloseDirectStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsOnCloseDirectStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsOnCloseDirectStreamCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsOnFlushDirectStreamCode; -extern const int s_readableStreamInternalsOnFlushDirectStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsOnFlushDirectStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsOnFlushDirectStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsOnFlushDirectStreamCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsCreateTextStreamCode; -extern const int s_readableStreamInternalsCreateTextStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsCreateTextStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsCreateTextStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsCreateTextStreamCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsInitializeTextStreamCode; -extern const int s_readableStreamInternalsInitializeTextStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsInitializeTextStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsInitializeTextStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsInitializeTextStreamCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsInitializeArrayStreamCode; -extern const int s_readableStreamInternalsInitializeArrayStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsInitializeArrayStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsInitializeArrayStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsInitializeArrayStreamCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsInitializeArrayBufferStreamCode; -extern const int s_readableStreamInternalsInitializeArrayBufferStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsInitializeArrayBufferStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsInitializeArrayBufferStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsInitializeArrayBufferStreamCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamErrorCode; -extern const int s_readableStreamInternalsReadableStreamErrorCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamErrorCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsIsReadableStreamLockedCode; -extern const int s_readableStreamInternalsIsReadableStreamLockedCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamLockedCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamLockedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamLockedCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamReaderGenericCancelCode; -extern const int s_readableStreamInternalsReadableStreamReaderGenericCancelCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamReaderGenericCancelCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamReaderGenericCancelCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamReaderGenericCancelCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamCancelCode; -extern const int s_readableStreamInternalsReadableStreamCancelCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamCancelCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamCancelCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamCancelCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerCancelCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerPullCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerPullCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerPullCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerPullCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerPullCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerCloseCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamCloseCode; -extern const int s_readableStreamInternalsReadableStreamCloseCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamCloseCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamFulfillReadRequestCode; -extern const int s_readableStreamInternalsReadableStreamFulfillReadRequestCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamFulfillReadRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamFulfillReadRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamFulfillReadRequestCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamDefaultReaderReadCode; -extern const int s_readableStreamInternalsReadableStreamDefaultReaderReadCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultReaderReadCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultReaderReadCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultReaderReadCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamAddReadRequestCode; -extern const int s_readableStreamInternalsReadableStreamAddReadRequestCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamAddReadRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamAddReadRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamAddReadRequestCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsIsReadableStreamDisturbedCode; -extern const int s_readableStreamInternalsIsReadableStreamDisturbedCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsIsReadableStreamDisturbedCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsIsReadableStreamDisturbedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsIsReadableStreamDisturbedCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamReaderGenericReleaseCode; -extern const int s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCode; -extern const int s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsLazyLoadStreamCode; -extern const int s_readableStreamInternalsLazyLoadStreamCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsLazyLoadStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsLazyLoadStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsLazyLoadStreamCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamIntoArrayCode; -extern const int s_readableStreamInternalsReadableStreamIntoArrayCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamIntoArrayCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamIntoArrayCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamIntoArrayCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamIntoTextCode; -extern const int s_readableStreamInternalsReadableStreamIntoTextCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamIntoTextCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamIntoTextCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamIntoTextCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamToArrayBufferDirectCode; -extern const int s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamToTextDirectCode; -extern const int s_readableStreamInternalsReadableStreamToTextDirectCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamToTextDirectCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamToTextDirectCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamToTextDirectCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamToArrayDirectCode; -extern const int s_readableStreamInternalsReadableStreamToArrayDirectCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamToArrayDirectCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamToArrayDirectCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamToArrayDirectCodeImplementationVisibility; -extern const char* const s_readableStreamInternalsReadableStreamDefineLazyIteratorsCode; -extern const int s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeLength; -extern const JSC::ConstructAbility s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeConstructAbility; -extern const JSC::ConstructorKind s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeConstructorKind; -extern const JSC::ImplementationVisibility s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeImplementationVisibility; - -#define WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_DATA(macro) \ - macro(readableStreamReaderGenericInitialize, readableStreamInternalsReadableStreamReaderGenericInitialize, 2) \ - macro(privateInitializeReadableStreamDefaultController, readableStreamInternalsPrivateInitializeReadableStreamDefaultController, 4) \ - macro(readableStreamDefaultControllerError, readableStreamInternalsReadableStreamDefaultControllerError, 2) \ - macro(readableStreamPipeTo, readableStreamInternalsReadableStreamPipeTo, 2) \ - macro(acquireReadableStreamDefaultReader, readableStreamInternalsAcquireReadableStreamDefaultReader, 1) \ - macro(setupReadableStreamDefaultController, readableStreamInternalsSetupReadableStreamDefaultController, 7) \ - macro(createReadableStreamController, readableStreamInternalsCreateReadableStreamController, 3) \ - macro(readableStreamDefaultControllerStart, readableStreamInternalsReadableStreamDefaultControllerStart, 1) \ - macro(readableStreamPipeToWritableStream, readableStreamInternalsReadableStreamPipeToWritableStream, 6) \ - macro(pipeToLoop, readableStreamInternalsPipeToLoop, 1) \ - macro(pipeToDoReadWrite, readableStreamInternalsPipeToDoReadWrite, 1) \ - macro(pipeToErrorsMustBePropagatedForward, readableStreamInternalsPipeToErrorsMustBePropagatedForward, 1) \ - macro(pipeToErrorsMustBePropagatedBackward, readableStreamInternalsPipeToErrorsMustBePropagatedBackward, 1) \ - macro(pipeToClosingMustBePropagatedForward, readableStreamInternalsPipeToClosingMustBePropagatedForward, 1) \ - macro(pipeToClosingMustBePropagatedBackward, readableStreamInternalsPipeToClosingMustBePropagatedBackward, 1) \ - macro(pipeToShutdownWithAction, readableStreamInternalsPipeToShutdownWithAction, 2) \ - macro(pipeToShutdown, readableStreamInternalsPipeToShutdown, 1) \ - macro(pipeToFinalize, readableStreamInternalsPipeToFinalize, 1) \ - macro(readableStreamTee, readableStreamInternalsReadableStreamTee, 2) \ - macro(readableStreamTeePullFunction, readableStreamInternalsReadableStreamTeePullFunction, 3) \ - macro(readableStreamTeeBranch1CancelFunction, readableStreamInternalsReadableStreamTeeBranch1CancelFunction, 2) \ - macro(readableStreamTeeBranch2CancelFunction, readableStreamInternalsReadableStreamTeeBranch2CancelFunction, 2) \ - macro(isReadableStream, readableStreamInternalsIsReadableStream, 1) \ - macro(isReadableStreamDefaultReader, readableStreamInternalsIsReadableStreamDefaultReader, 1) \ - macro(isReadableStreamDefaultController, readableStreamInternalsIsReadableStreamDefaultController, 1) \ - macro(readDirectStream, readableStreamInternalsReadDirectStream, 3) \ - macro(assignToStream, readableStreamInternalsAssignToStream, 2) \ - macro(readStreamIntoSink, readableStreamInternalsReadStreamIntoSink, 3) \ - macro(handleDirectStreamError, readableStreamInternalsHandleDirectStreamError, 1) \ - macro(handleDirectStreamErrorReject, readableStreamInternalsHandleDirectStreamErrorReject, 1) \ - macro(onPullDirectStream, readableStreamInternalsOnPullDirectStream, 1) \ - macro(noopDoneFunction, readableStreamInternalsNoopDoneFunction, 0) \ - macro(onReadableStreamDirectControllerClosed, readableStreamInternalsOnReadableStreamDirectControllerClosed, 1) \ - macro(onCloseDirectStream, readableStreamInternalsOnCloseDirectStream, 1) \ - macro(onFlushDirectStream, readableStreamInternalsOnFlushDirectStream, 0) \ - macro(createTextStream, readableStreamInternalsCreateTextStream, 1) \ - macro(initializeTextStream, readableStreamInternalsInitializeTextStream, 2) \ - macro(initializeArrayStream, readableStreamInternalsInitializeArrayStream, 2) \ - macro(initializeArrayBufferStream, readableStreamInternalsInitializeArrayBufferStream, 2) \ - macro(readableStreamError, readableStreamInternalsReadableStreamError, 2) \ - macro(readableStreamDefaultControllerShouldCallPull, readableStreamInternalsReadableStreamDefaultControllerShouldCallPull, 1) \ - macro(readableStreamDefaultControllerCallPullIfNeeded, readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeeded, 1) \ - macro(isReadableStreamLocked, readableStreamInternalsIsReadableStreamLocked, 1) \ - macro(readableStreamDefaultControllerGetDesiredSize, readableStreamInternalsReadableStreamDefaultControllerGetDesiredSize, 1) \ - macro(readableStreamReaderGenericCancel, readableStreamInternalsReadableStreamReaderGenericCancel, 2) \ - macro(readableStreamCancel, readableStreamInternalsReadableStreamCancel, 2) \ - macro(readableStreamDefaultControllerCancel, readableStreamInternalsReadableStreamDefaultControllerCancel, 2) \ - macro(readableStreamDefaultControllerPull, readableStreamInternalsReadableStreamDefaultControllerPull, 1) \ - macro(readableStreamDefaultControllerClose, readableStreamInternalsReadableStreamDefaultControllerClose, 1) \ - macro(readableStreamClose, readableStreamInternalsReadableStreamClose, 1) \ - macro(readableStreamFulfillReadRequest, readableStreamInternalsReadableStreamFulfillReadRequest, 3) \ - macro(readableStreamDefaultControllerEnqueue, readableStreamInternalsReadableStreamDefaultControllerEnqueue, 2) \ - macro(readableStreamDefaultReaderRead, readableStreamInternalsReadableStreamDefaultReaderRead, 1) \ - macro(readableStreamAddReadRequest, readableStreamInternalsReadableStreamAddReadRequest, 1) \ - macro(isReadableStreamDisturbed, readableStreamInternalsIsReadableStreamDisturbed, 1) \ - macro(readableStreamReaderGenericRelease, readableStreamInternalsReadableStreamReaderGenericRelease, 1) \ - macro(readableStreamDefaultControllerCanCloseOrEnqueue, readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueue, 1) \ - macro(lazyLoadStream, readableStreamInternalsLazyLoadStream, 2) \ - macro(readableStreamIntoArray, readableStreamInternalsReadableStreamIntoArray, 1) \ - macro(readableStreamIntoText, readableStreamInternalsReadableStreamIntoText, 1) \ - macro(readableStreamToArrayBufferDirect, readableStreamInternalsReadableStreamToArrayBufferDirect, 2) \ - macro(readableStreamToTextDirect, readableStreamInternalsReadableStreamToTextDirect, 2) \ - macro(readableStreamToArrayDirect, readableStreamInternalsReadableStreamToArrayDirect, 2) \ - macro(readableStreamDefineLazyIterators, readableStreamInternalsReadableStreamDefineLazyIterators, 1) \ - -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMREADERGENERICINITIALIZE 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PRIVATEINITIALIZEREADABLESTREAMDEFAULTCONTROLLER 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERERROR 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMPIPETO 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ACQUIREREADABLESTREAMDEFAULTREADER 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_SETUPREADABLESTREAMDEFAULTCONTROLLER 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_CREATEREADABLESTREAMCONTROLLER 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERSTART 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMPIPETOWRITABLESTREAM 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PIPETOLOOP 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PIPETODOREADWRITE 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PIPETOERRORSMUSTBEPROPAGATEDFORWARD 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PIPETOERRORSMUSTBEPROPAGATEDBACKWARD 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PIPETOCLOSINGMUSTBEPROPAGATEDFORWARD 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PIPETOCLOSINGMUSTBEPROPAGATEDBACKWARD 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PIPETOSHUTDOWNWITHACTION 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PIPETOSHUTDOWN 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_PIPETOFINALIZE 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMTEE 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMTEEPULLFUNCTION 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMTEEBRANCH1CANCELFUNCTION 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMTEEBRANCH2CANCELFUNCTION 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ISREADABLESTREAM 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ISREADABLESTREAMDEFAULTREADER 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ISREADABLESTREAMDEFAULTCONTROLLER 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READDIRECTSTREAM 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ASSIGNTOSTREAM 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READSTREAMINTOSINK 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_HANDLEDIRECTSTREAMERROR 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_HANDLEDIRECTSTREAMERRORREJECT 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ONPULLDIRECTSTREAM 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_NOOPDONEFUNCTION 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ONREADABLESTREAMDIRECTCONTROLLERCLOSED 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ONCLOSEDIRECTSTREAM 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ONFLUSHDIRECTSTREAM 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_CREATETEXTSTREAM 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_INITIALIZETEXTSTREAM 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_INITIALIZEARRAYSTREAM 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_INITIALIZEARRAYBUFFERSTREAM 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMERROR 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERSHOULDCALLPULL 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERCALLPULLIFNEEDED 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ISREADABLESTREAMLOCKED 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERGETDESIREDSIZE 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMREADERGENERICCANCEL 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMCANCEL 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERCANCEL 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERPULL 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERCLOSE 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMCLOSE 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMFULFILLREADREQUEST 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERENQUEUE 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTREADERREAD 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMADDREADREQUEST 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_ISREADABLESTREAMDISTURBED 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMREADERGENERICRELEASE 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFAULTCONTROLLERCANCLOSEORENQUEUE 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_LAZYLOADSTREAM 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMINTOARRAY 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMINTOTEXT 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMTOARRAYBUFFERDIRECT 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMTOTEXTDIRECT 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMTOARRAYDIRECT 1 -#define WEBCORE_BUILTIN_READABLESTREAMINTERNALS_READABLESTREAMDEFINELAZYITERATORS 1 - -#define WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_CODE(macro) \ - macro(readableStreamInternalsReadableStreamReaderGenericInitializeCode, readableStreamReaderGenericInitialize, ASCIILiteral(), s_readableStreamInternalsReadableStreamReaderGenericInitializeCodeLength) \ - macro(readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCode, privateInitializeReadableStreamDefaultController, ASCIILiteral(), s_readableStreamInternalsPrivateInitializeReadableStreamDefaultControllerCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerErrorCode, readableStreamDefaultControllerError, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerErrorCodeLength) \ - macro(readableStreamInternalsReadableStreamPipeToCode, readableStreamPipeTo, ASCIILiteral(), s_readableStreamInternalsReadableStreamPipeToCodeLength) \ - macro(readableStreamInternalsAcquireReadableStreamDefaultReaderCode, acquireReadableStreamDefaultReader, ASCIILiteral(), s_readableStreamInternalsAcquireReadableStreamDefaultReaderCodeLength) \ - macro(readableStreamInternalsSetupReadableStreamDefaultControllerCode, setupReadableStreamDefaultController, ASCIILiteral(), s_readableStreamInternalsSetupReadableStreamDefaultControllerCodeLength) \ - macro(readableStreamInternalsCreateReadableStreamControllerCode, createReadableStreamController, ASCIILiteral(), s_readableStreamInternalsCreateReadableStreamControllerCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerStartCode, readableStreamDefaultControllerStart, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerStartCodeLength) \ - macro(readableStreamInternalsReadableStreamPipeToWritableStreamCode, readableStreamPipeToWritableStream, ASCIILiteral(), s_readableStreamInternalsReadableStreamPipeToWritableStreamCodeLength) \ - macro(readableStreamInternalsPipeToLoopCode, pipeToLoop, ASCIILiteral(), s_readableStreamInternalsPipeToLoopCodeLength) \ - macro(readableStreamInternalsPipeToDoReadWriteCode, pipeToDoReadWrite, ASCIILiteral(), s_readableStreamInternalsPipeToDoReadWriteCodeLength) \ - macro(readableStreamInternalsPipeToErrorsMustBePropagatedForwardCode, pipeToErrorsMustBePropagatedForward, ASCIILiteral(), s_readableStreamInternalsPipeToErrorsMustBePropagatedForwardCodeLength) \ - macro(readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCode, pipeToErrorsMustBePropagatedBackward, ASCIILiteral(), s_readableStreamInternalsPipeToErrorsMustBePropagatedBackwardCodeLength) \ - macro(readableStreamInternalsPipeToClosingMustBePropagatedForwardCode, pipeToClosingMustBePropagatedForward, ASCIILiteral(), s_readableStreamInternalsPipeToClosingMustBePropagatedForwardCodeLength) \ - macro(readableStreamInternalsPipeToClosingMustBePropagatedBackwardCode, pipeToClosingMustBePropagatedBackward, ASCIILiteral(), s_readableStreamInternalsPipeToClosingMustBePropagatedBackwardCodeLength) \ - macro(readableStreamInternalsPipeToShutdownWithActionCode, pipeToShutdownWithAction, ASCIILiteral(), s_readableStreamInternalsPipeToShutdownWithActionCodeLength) \ - macro(readableStreamInternalsPipeToShutdownCode, pipeToShutdown, ASCIILiteral(), s_readableStreamInternalsPipeToShutdownCodeLength) \ - macro(readableStreamInternalsPipeToFinalizeCode, pipeToFinalize, ASCIILiteral(), s_readableStreamInternalsPipeToFinalizeCodeLength) \ - macro(readableStreamInternalsReadableStreamTeeCode, readableStreamTee, ASCIILiteral(), s_readableStreamInternalsReadableStreamTeeCodeLength) \ - macro(readableStreamInternalsReadableStreamTeePullFunctionCode, readableStreamTeePullFunction, ASCIILiteral(), s_readableStreamInternalsReadableStreamTeePullFunctionCodeLength) \ - macro(readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCode, readableStreamTeeBranch1CancelFunction, ASCIILiteral(), s_readableStreamInternalsReadableStreamTeeBranch1CancelFunctionCodeLength) \ - macro(readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCode, readableStreamTeeBranch2CancelFunction, ASCIILiteral(), s_readableStreamInternalsReadableStreamTeeBranch2CancelFunctionCodeLength) \ - macro(readableStreamInternalsIsReadableStreamCode, isReadableStream, ASCIILiteral(), s_readableStreamInternalsIsReadableStreamCodeLength) \ - macro(readableStreamInternalsIsReadableStreamDefaultReaderCode, isReadableStreamDefaultReader, ASCIILiteral(), s_readableStreamInternalsIsReadableStreamDefaultReaderCodeLength) \ - macro(readableStreamInternalsIsReadableStreamDefaultControllerCode, isReadableStreamDefaultController, ASCIILiteral(), s_readableStreamInternalsIsReadableStreamDefaultControllerCodeLength) \ - macro(readableStreamInternalsReadDirectStreamCode, readDirectStream, ASCIILiteral(), s_readableStreamInternalsReadDirectStreamCodeLength) \ - macro(readableStreamInternalsAssignToStreamCode, assignToStream, ASCIILiteral(), s_readableStreamInternalsAssignToStreamCodeLength) \ - macro(readableStreamInternalsReadStreamIntoSinkCode, readStreamIntoSink, ASCIILiteral(), s_readableStreamInternalsReadStreamIntoSinkCodeLength) \ - macro(readableStreamInternalsHandleDirectStreamErrorCode, handleDirectStreamError, ASCIILiteral(), s_readableStreamInternalsHandleDirectStreamErrorCodeLength) \ - macro(readableStreamInternalsHandleDirectStreamErrorRejectCode, handleDirectStreamErrorReject, ASCIILiteral(), s_readableStreamInternalsHandleDirectStreamErrorRejectCodeLength) \ - macro(readableStreamInternalsOnPullDirectStreamCode, onPullDirectStream, ASCIILiteral(), s_readableStreamInternalsOnPullDirectStreamCodeLength) \ - macro(readableStreamInternalsNoopDoneFunctionCode, noopDoneFunction, ASCIILiteral(), s_readableStreamInternalsNoopDoneFunctionCodeLength) \ - macro(readableStreamInternalsOnReadableStreamDirectControllerClosedCode, onReadableStreamDirectControllerClosed, ASCIILiteral(), s_readableStreamInternalsOnReadableStreamDirectControllerClosedCodeLength) \ - macro(readableStreamInternalsOnCloseDirectStreamCode, onCloseDirectStream, ASCIILiteral(), s_readableStreamInternalsOnCloseDirectStreamCodeLength) \ - macro(readableStreamInternalsOnFlushDirectStreamCode, onFlushDirectStream, ASCIILiteral(), s_readableStreamInternalsOnFlushDirectStreamCodeLength) \ - macro(readableStreamInternalsCreateTextStreamCode, createTextStream, ASCIILiteral(), s_readableStreamInternalsCreateTextStreamCodeLength) \ - macro(readableStreamInternalsInitializeTextStreamCode, initializeTextStream, ASCIILiteral(), s_readableStreamInternalsInitializeTextStreamCodeLength) \ - macro(readableStreamInternalsInitializeArrayStreamCode, initializeArrayStream, ASCIILiteral(), s_readableStreamInternalsInitializeArrayStreamCodeLength) \ - macro(readableStreamInternalsInitializeArrayBufferStreamCode, initializeArrayBufferStream, ASCIILiteral(), s_readableStreamInternalsInitializeArrayBufferStreamCodeLength) \ - macro(readableStreamInternalsReadableStreamErrorCode, readableStreamError, ASCIILiteral(), s_readableStreamInternalsReadableStreamErrorCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCode, readableStreamDefaultControllerShouldCallPull, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerShouldCallPullCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCode, readableStreamDefaultControllerCallPullIfNeeded, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerCallPullIfNeededCodeLength) \ - macro(readableStreamInternalsIsReadableStreamLockedCode, isReadableStreamLocked, ASCIILiteral(), s_readableStreamInternalsIsReadableStreamLockedCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCode, readableStreamDefaultControllerGetDesiredSize, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerGetDesiredSizeCodeLength) \ - macro(readableStreamInternalsReadableStreamReaderGenericCancelCode, readableStreamReaderGenericCancel, ASCIILiteral(), s_readableStreamInternalsReadableStreamReaderGenericCancelCodeLength) \ - macro(readableStreamInternalsReadableStreamCancelCode, readableStreamCancel, ASCIILiteral(), s_readableStreamInternalsReadableStreamCancelCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerCancelCode, readableStreamDefaultControllerCancel, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerCancelCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerPullCode, readableStreamDefaultControllerPull, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerPullCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerCloseCode, readableStreamDefaultControllerClose, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerCloseCodeLength) \ - macro(readableStreamInternalsReadableStreamCloseCode, readableStreamClose, ASCIILiteral(), s_readableStreamInternalsReadableStreamCloseCodeLength) \ - macro(readableStreamInternalsReadableStreamFulfillReadRequestCode, readableStreamFulfillReadRequest, ASCIILiteral(), s_readableStreamInternalsReadableStreamFulfillReadRequestCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerEnqueueCode, readableStreamDefaultControllerEnqueue, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerEnqueueCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultReaderReadCode, readableStreamDefaultReaderRead, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultReaderReadCodeLength) \ - macro(readableStreamInternalsReadableStreamAddReadRequestCode, readableStreamAddReadRequest, ASCIILiteral(), s_readableStreamInternalsReadableStreamAddReadRequestCodeLength) \ - macro(readableStreamInternalsIsReadableStreamDisturbedCode, isReadableStreamDisturbed, ASCIILiteral(), s_readableStreamInternalsIsReadableStreamDisturbedCodeLength) \ - macro(readableStreamInternalsReadableStreamReaderGenericReleaseCode, readableStreamReaderGenericRelease, ASCIILiteral(), s_readableStreamInternalsReadableStreamReaderGenericReleaseCodeLength) \ - macro(readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCode, readableStreamDefaultControllerCanCloseOrEnqueue, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefaultControllerCanCloseOrEnqueueCodeLength) \ - macro(readableStreamInternalsLazyLoadStreamCode, lazyLoadStream, ASCIILiteral(), s_readableStreamInternalsLazyLoadStreamCodeLength) \ - macro(readableStreamInternalsReadableStreamIntoArrayCode, readableStreamIntoArray, ASCIILiteral(), s_readableStreamInternalsReadableStreamIntoArrayCodeLength) \ - macro(readableStreamInternalsReadableStreamIntoTextCode, readableStreamIntoText, ASCIILiteral(), s_readableStreamInternalsReadableStreamIntoTextCodeLength) \ - macro(readableStreamInternalsReadableStreamToArrayBufferDirectCode, readableStreamToArrayBufferDirect, ASCIILiteral(), s_readableStreamInternalsReadableStreamToArrayBufferDirectCodeLength) \ - macro(readableStreamInternalsReadableStreamToTextDirectCode, readableStreamToTextDirect, ASCIILiteral(), s_readableStreamInternalsReadableStreamToTextDirectCodeLength) \ - macro(readableStreamInternalsReadableStreamToArrayDirectCode, readableStreamToArrayDirect, ASCIILiteral(), s_readableStreamInternalsReadableStreamToArrayDirectCodeLength) \ - macro(readableStreamInternalsReadableStreamDefineLazyIteratorsCode, readableStreamDefineLazyIterators, ASCIILiteral(), s_readableStreamInternalsReadableStreamDefineLazyIteratorsCodeLength) \ - -#define WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(macro) \ - macro(acquireReadableStreamDefaultReader) \ - macro(assignToStream) \ - macro(createReadableStreamController) \ - macro(createTextStream) \ - macro(handleDirectStreamError) \ - macro(handleDirectStreamErrorReject) \ - macro(initializeArrayBufferStream) \ - macro(initializeArrayStream) \ - macro(initializeTextStream) \ - macro(isReadableStream) \ - macro(isReadableStreamDefaultController) \ - macro(isReadableStreamDefaultReader) \ - macro(isReadableStreamDisturbed) \ - macro(isReadableStreamLocked) \ - macro(lazyLoadStream) \ - macro(noopDoneFunction) \ - macro(onCloseDirectStream) \ - macro(onFlushDirectStream) \ - macro(onPullDirectStream) \ - macro(onReadableStreamDirectControllerClosed) \ - macro(pipeToClosingMustBePropagatedBackward) \ - macro(pipeToClosingMustBePropagatedForward) \ - macro(pipeToDoReadWrite) \ - macro(pipeToErrorsMustBePropagatedBackward) \ - macro(pipeToErrorsMustBePropagatedForward) \ - macro(pipeToFinalize) \ - macro(pipeToLoop) \ - macro(pipeToShutdown) \ - macro(pipeToShutdownWithAction) \ - macro(privateInitializeReadableStreamDefaultController) \ - macro(readDirectStream) \ - macro(readStreamIntoSink) \ - macro(readableStreamAddReadRequest) \ - macro(readableStreamCancel) \ - macro(readableStreamClose) \ - macro(readableStreamDefaultControllerCallPullIfNeeded) \ - macro(readableStreamDefaultControllerCanCloseOrEnqueue) \ - macro(readableStreamDefaultControllerCancel) \ - macro(readableStreamDefaultControllerClose) \ - macro(readableStreamDefaultControllerEnqueue) \ - macro(readableStreamDefaultControllerError) \ - macro(readableStreamDefaultControllerGetDesiredSize) \ - macro(readableStreamDefaultControllerPull) \ - macro(readableStreamDefaultControllerShouldCallPull) \ - macro(readableStreamDefaultControllerStart) \ - macro(readableStreamDefaultReaderRead) \ - macro(readableStreamDefineLazyIterators) \ - macro(readableStreamError) \ - macro(readableStreamFulfillReadRequest) \ - macro(readableStreamIntoArray) \ - macro(readableStreamIntoText) \ - macro(readableStreamPipeTo) \ - macro(readableStreamPipeToWritableStream) \ - macro(readableStreamReaderGenericCancel) \ - macro(readableStreamReaderGenericInitialize) \ - macro(readableStreamReaderGenericRelease) \ - macro(readableStreamTee) \ - macro(readableStreamTeeBranch1CancelFunction) \ - macro(readableStreamTeeBranch2CancelFunction) \ - macro(readableStreamTeePullFunction) \ - macro(readableStreamToArrayBufferDirect) \ - macro(readableStreamToArrayDirect) \ - macro(readableStreamToTextDirect) \ - macro(setupReadableStreamDefaultController) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ReadableStreamInternalsBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ReadableStreamInternalsBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ReadableStreamInternalsBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ReadableStreamInternalsBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -class ReadableStreamInternalsBuiltinFunctions { -public: - explicit ReadableStreamInternalsBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { } - - void init(JSC::JSGlobalObject&); - template<typename Visitor> void visit(Visitor&); - -public: - JSC::VM& m_vm; - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \ - JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function; - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS -}; - -inline void ReadableStreamInternalsBuiltinFunctions::init(JSC::JSGlobalObject& globalObject) -{ -#define EXPORT_FUNCTION(codeName, functionName, overriddenName, length)\ - m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject)); - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_CODE(EXPORT_FUNCTION) -#undef EXPORT_FUNCTION -} - -template<typename Visitor> -inline void ReadableStreamInternalsBuiltinFunctions::visit(Visitor& visitor) -{ -#define VISIT_FUNCTION(name) visitor.append(m_##name##Function); - WEBCORE_FOREACH_READABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION) -#undef VISIT_FUNCTION -} - -template void ReadableStreamInternalsBuiltinFunctions::visit(JSC::AbstractSlotVisitor&); -template void ReadableStreamInternalsBuiltinFunctions::visit(JSC::SlotVisitor&); - - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/StreamInternalsBuiltins.cpp b/src/bun.js/builtins/cpp/StreamInternalsBuiltins.cpp deleted file mode 100644 index 7f84dd40e..000000000 --- a/src/bun.js/builtins/cpp/StreamInternalsBuiltins.cpp +++ /dev/null @@ -1,489 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "StreamInternalsBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_streamInternalsMarkPromiseAsHandledCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsMarkPromiseAsHandledCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsMarkPromiseAsHandledCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsMarkPromiseAsHandledCodeLength = 217; -static const JSC::Intrinsic s_streamInternalsMarkPromiseAsHandledCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsMarkPromiseAsHandledCode = - "(function (promise)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@isPromise(promise));\n" \ - " @putPromiseInternalField(promise, @promiseFieldFlags, @getPromiseInternalField(promise, @promiseFieldFlags) | @promiseFlagsIsHandled);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_streamInternalsShieldingPromiseResolveCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsShieldingPromiseResolveCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsShieldingPromiseResolveCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsShieldingPromiseResolveCodeLength = 198; -static const JSC::Intrinsic s_streamInternalsShieldingPromiseResolveCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsShieldingPromiseResolveCode = - "(function (result)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const promise = @Promise.@resolve(result);\n" \ - " if (promise.@then === @undefined)\n" \ - " promise.@then = @Promise.prototype.@then;\n" \ - " return promise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeLength = 190; -static const JSC::Intrinsic s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCode = - "(function (object, method, args)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (method === @undefined)\n" \ - " return @Promise.@resolve();\n" \ - " return @shieldingPromiseResolve(method.@apply(object, args));\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrNoopNoCatchCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrNoopNoCatchCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrNoopNoCatchCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsPromiseInvokeOrNoopNoCatchCodeLength = 127; -static const JSC::Intrinsic s_streamInternalsPromiseInvokeOrNoopNoCatchCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsPromiseInvokeOrNoopNoCatchCode = - "(function (object, key, args)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " return @promiseInvokeOrNoopMethodNoCatch(object, object[key], args);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrNoopMethodCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrNoopMethodCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrNoopMethodCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsPromiseInvokeOrNoopMethodCodeLength = 210; -static const JSC::Intrinsic s_streamInternalsPromiseInvokeOrNoopMethodCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsPromiseInvokeOrNoopMethodCode = - "(function (object, method, args)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " try {\n" \ - " return @promiseInvokeOrNoopMethodNoCatch(object, method, args);\n" \ - " }\n" \ - " catch(error) {\n" \ - " return @Promise.@reject(error);\n" \ - " }\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrNoopCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrNoopCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrNoopCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsPromiseInvokeOrNoopCodeLength = 198; -static const JSC::Intrinsic s_streamInternalsPromiseInvokeOrNoopCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsPromiseInvokeOrNoopCode = - "(function (object, key, args)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " try {\n" \ - " return @promiseInvokeOrNoopNoCatch(object, key, args);\n" \ - " }\n" \ - " catch(error) {\n" \ - " return @Promise.@reject(error);\n" \ - " }\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeLength = 362; -static const JSC::Intrinsic s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsPromiseInvokeOrFallbackOrNoopCode = - "(function (object, key1, args1, key2, args2)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " try {\n" \ - " const method = object[key1];\n" \ - " if (method === @undefined)\n" \ - " return @promiseInvokeOrNoopNoCatch(object, key2, args2);\n" \ - " return @shieldingPromiseResolve(method.@apply(object, args1));\n" \ - " }\n" \ - " catch(error) {\n" \ - " return @Promise.@reject(error);\n" \ - " }\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_streamInternalsValidateAndNormalizeQueuingStrategyCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsValidateAndNormalizeQueuingStrategyCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsValidateAndNormalizeQueuingStrategyCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsValidateAndNormalizeQueuingStrategyCodeLength = 430; -static const JSC::Intrinsic s_streamInternalsValidateAndNormalizeQueuingStrategyCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsValidateAndNormalizeQueuingStrategyCode = - "(function (size, highWaterMark)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (size !== @undefined && typeof size !== \"function\")\n" \ - " @throwTypeError(\"size parameter must be a function\");\n" \ - "\n" \ - " const newHighWaterMark = @toNumber(highWaterMark);\n" \ - "\n" \ - " if (@isNaN(newHighWaterMark) || newHighWaterMark < 0)\n" \ - " @throwRangeError(\"highWaterMark value is negative or not a number\");\n" \ - "\n" \ - " return { size: size, highWaterMark: newHighWaterMark };\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_streamInternalsCreateFIFOCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsCreateFIFOCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsCreateFIFOCodeImplementationVisibility = JSC::ImplementationVisibility::Private; -const int s_streamInternalsCreateFIFOCodeLength = 2863; -static const JSC::Intrinsic s_streamInternalsCreateFIFOCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsCreateFIFOCode = - "(function () {\n" \ - " \"use strict\";\n" \ - " var slice = @Array.prototype.slice;\n" \ - "\n" \ - " class Denqueue {\n" \ - " constructor() {\n" \ - " this._head = 0;\n" \ - " this._tail = 0;\n" \ - " //\n" \ - " this._capacityMask = 0x3;\n" \ - " this._list = @newArrayWithSize(4);\n" \ - " }\n" \ - "\n" \ - " _head;\n" \ - " _tail;\n" \ - " _capacityMask;\n" \ - " _list;\n" \ - " \n" \ - " size() {\n" \ - " if (this._head === this._tail) return 0;\n" \ - " if (this._head < this._tail) return this._tail - this._head;\n" \ - " else return this._capacityMask + 1 - (this._head - this._tail);\n" \ - " }\n" \ - "\n" \ - " isEmpty() {\n" \ - " return this.size() == 0;\n" \ - " }\n" \ - "\n" \ - " isNotEmpty() {\n" \ - " return this.size() > 0;\n" \ - " }\n" \ - " \n" \ - " shift() {\n" \ - " var { _head: head, _tail, _list, _capacityMask } = this;\n" \ - " if (head === _tail) return @undefined;\n" \ - " var item = _list[head];\n" \ - " @putByValDirect(_list, head, @undefined);\n" \ - " head = this._head = (head + 1) & _capacityMask;\n" \ - " if (head < 2 && _tail > 10000 && _tail <= _list.length >>> 2) this._shrinkArray();\n" \ - " return item;\n" \ - " }\n" \ - "\n" \ - " peek() {\n" \ - " if (this._head === this._tail) return @undefined;\n" \ - " return this._list[this._head];\n" \ - " }\n" \ - " \n" \ - " push(item) {\n" \ - " var tail = this._tail;\n" \ - " @putByValDirect(this._list, tail, item);\n" \ - " this._tail = (tail + 1) & this._capacityMask;\n" \ - " if (this._tail === this._head) {\n" \ - " this._growArray();\n" \ - " }\n" \ - " //\n" \ - " //\n" \ - " //\n" \ - " }\n" \ - " \n" \ - " toArray(fullCopy) {\n" \ - " var list = this._list;\n" \ - " var len = @toLength(list.length);\n" \ - " \n" \ - " if (fullCopy || this._head > this._tail) {\n" \ - " var _head = @toLength(this._head);\n" \ - " var _tail = @toLength(this._tail);\n" \ - " var total = @toLength((len - _head) + _tail);\n" \ - " var array = @newArrayWithSize(total);\n" \ - " var j = 0;\n" \ - " for (var i = _head; i < len; i++) @putByValDirect(array, j++, list[i]);\n" \ - " for (var i = 0; i < _tail; i++) @putByValDirect(array, j++, list[i]);\n" \ - " return array;\n" \ - " } else {\n" \ - " return slice.@call(list, this._head, this._tail);\n" \ - " }\n" \ - " }\n" \ - " \n" \ - " clear() {\n" \ - " this._head = 0;\n" \ - " this._tail = 0;\n" \ - " this._list.fill(undefined);\n" \ - " }\n" \ - "\n" \ - " _growArray() {\n" \ - " if (this._head) {\n" \ - " //\n" \ - " this._list = this.toArray(true);\n" \ - " this._head = 0;\n" \ - " }\n" \ - " \n" \ - " //\n" \ - " this._tail = @toLength(this._list.length);\n" \ - " \n" \ - " this._list.length <<= 1;\n" \ - " this._capacityMask = (this._capacityMask << 1) | 1;\n" \ - " }\n" \ - " \n" \ - " shrinkArray() {\n" \ - " this._list.length >>>= 1;\n" \ - " this._capacityMask >>>= 1;\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " \n" \ - " return new Denqueue();\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_streamInternalsNewQueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsNewQueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsNewQueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsNewQueueCodeLength = 85; -static const JSC::Intrinsic s_streamInternalsNewQueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsNewQueueCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " return { content: @createFIFO(), size: 0 };\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_streamInternalsDequeueValueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsDequeueValueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsDequeueValueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsDequeueValueCodeLength = 195; -static const JSC::Intrinsic s_streamInternalsDequeueValueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsDequeueValueCode = - "(function (queue)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const record = queue.content.shift();\n" \ - " queue.size -= record.size;\n" \ - " //\n" \ - " if (queue.size < 0)\n" \ - " queue.size = 0;\n" \ - " return record.value;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_streamInternalsEnqueueValueWithSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsEnqueueValueWithSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsEnqueueValueWithSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsEnqueueValueWithSizeCodeLength = 248; -static const JSC::Intrinsic s_streamInternalsEnqueueValueWithSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsEnqueueValueWithSizeCode = - "(function (queue, value, size)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " size = @toNumber(size);\n" \ - " if (!@isFinite(size) || size < 0)\n" \ - " @throwRangeError(\"size has an incorrect value\");\n" \ - " \n" \ - " queue.content.push({ value, size });\n" \ - " queue.size += size;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_streamInternalsPeekQueueValueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsPeekQueueValueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsPeekQueueValueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsPeekQueueValueCodeLength = 81; -static const JSC::Intrinsic s_streamInternalsPeekQueueValueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsPeekQueueValueCode = - "(function (queue)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " return queue.content.peek()?.value;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_streamInternalsResetQueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsResetQueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsResetQueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsResetQueueCodeLength = 152; -static const JSC::Intrinsic s_streamInternalsResetQueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsResetQueueCode = - "(function (queue)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(\"content\" in queue);\n" \ - " @assert(\"size\" in queue);\n" \ - " queue.content.clear();\n" \ - " queue.size = 0;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_streamInternalsExtractSizeAlgorithmCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsExtractSizeAlgorithmCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsExtractSizeAlgorithmCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsExtractSizeAlgorithmCodeLength = 294; -static const JSC::Intrinsic s_streamInternalsExtractSizeAlgorithmCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsExtractSizeAlgorithmCode = - "(function (strategy)\n" \ - "{\n" \ - " const sizeAlgorithm = strategy.size;\n" \ - "\n" \ - " if (sizeAlgorithm === @undefined)\n" \ - " return () => 1;\n" \ - "\n" \ - " if (typeof sizeAlgorithm !== \"function\")\n" \ - " @throwTypeError(\"strategy.size must be a function\");\n" \ - "\n" \ - " return (chunk) => { return sizeAlgorithm(chunk); };\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_streamInternalsExtractHighWaterMarkCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsExtractHighWaterMarkCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsExtractHighWaterMarkCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsExtractHighWaterMarkCodeLength = 322; -static const JSC::Intrinsic s_streamInternalsExtractHighWaterMarkCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsExtractHighWaterMarkCode = - "(function (strategy, defaultHWM)\n" \ - "{\n" \ - " const highWaterMark = strategy.highWaterMark;\n" \ - "\n" \ - " if (highWaterMark === @undefined)\n" \ - " return defaultHWM;\n" \ - "\n" \ - " if (@isNaN(highWaterMark) || highWaterMark < 0)\n" \ - " @throwRangeError(\"highWaterMark value is negative or not a number\");\n" \ - "\n" \ - " return @toNumber(highWaterMark);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeLength = 335; -static const JSC::Intrinsic s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCode = - "(function (init)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isObject(init))\n" \ - " @throwTypeError(\"QueuingStrategyInit argument must be an object.\");\n" \ - " const {highWaterMark} = init;\n" \ - " if (highWaterMark === @undefined)\n" \ - " @throwTypeError(\"QueuingStrategyInit.highWaterMark member is required.\");\n" \ - "\n" \ - " return @toNumber(highWaterMark);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_streamInternalsCreateFulfilledPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsCreateFulfilledPromiseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsCreateFulfilledPromiseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsCreateFulfilledPromiseCodeLength = 115; -static const JSC::Intrinsic s_streamInternalsCreateFulfilledPromiseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsCreateFulfilledPromiseCode = - "(function (value)\n" \ - "{\n" \ - " const promise = @newPromise();\n" \ - " @fulfillPromise(promise, value);\n" \ - " return promise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_streamInternalsToDictionaryCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_streamInternalsToDictionaryCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_streamInternalsToDictionaryCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_streamInternalsToDictionaryCodeLength = 212; -static const JSC::Intrinsic s_streamInternalsToDictionaryCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_streamInternalsToDictionaryCode = - "(function (value, defaultValue, errorMessage)\n" \ - "{\n" \ - " if (value === @undefined || value === null)\n" \ - " return defaultValue;\n" \ - " if (!@isObject(value))\n" \ - " @throwTypeError(errorMessage);\n" \ - " return value;\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().streamInternalsBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().streamInternalsBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/StreamInternalsBuiltins.h b/src/bun.js/builtins/cpp/StreamInternalsBuiltins.h deleted file mode 100644 index b068e244c..000000000 --- a/src/bun.js/builtins/cpp/StreamInternalsBuiltins.h +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* StreamInternals */ -extern const char* const s_streamInternalsMarkPromiseAsHandledCode; -extern const int s_streamInternalsMarkPromiseAsHandledCodeLength; -extern const JSC::ConstructAbility s_streamInternalsMarkPromiseAsHandledCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsMarkPromiseAsHandledCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsMarkPromiseAsHandledCodeImplementationVisibility; -extern const char* const s_streamInternalsShieldingPromiseResolveCode; -extern const int s_streamInternalsShieldingPromiseResolveCodeLength; -extern const JSC::ConstructAbility s_streamInternalsShieldingPromiseResolveCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsShieldingPromiseResolveCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsShieldingPromiseResolveCodeImplementationVisibility; -extern const char* const s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCode; -extern const int s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeLength; -extern const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeImplementationVisibility; -extern const char* const s_streamInternalsPromiseInvokeOrNoopNoCatchCode; -extern const int s_streamInternalsPromiseInvokeOrNoopNoCatchCodeLength; -extern const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrNoopNoCatchCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrNoopNoCatchCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrNoopNoCatchCodeImplementationVisibility; -extern const char* const s_streamInternalsPromiseInvokeOrNoopMethodCode; -extern const int s_streamInternalsPromiseInvokeOrNoopMethodCodeLength; -extern const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrNoopMethodCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrNoopMethodCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrNoopMethodCodeImplementationVisibility; -extern const char* const s_streamInternalsPromiseInvokeOrNoopCode; -extern const int s_streamInternalsPromiseInvokeOrNoopCodeLength; -extern const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrNoopCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrNoopCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrNoopCodeImplementationVisibility; -extern const char* const s_streamInternalsPromiseInvokeOrFallbackOrNoopCode; -extern const int s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeLength; -extern const JSC::ConstructAbility s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeImplementationVisibility; -extern const char* const s_streamInternalsValidateAndNormalizeQueuingStrategyCode; -extern const int s_streamInternalsValidateAndNormalizeQueuingStrategyCodeLength; -extern const JSC::ConstructAbility s_streamInternalsValidateAndNormalizeQueuingStrategyCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsValidateAndNormalizeQueuingStrategyCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsValidateAndNormalizeQueuingStrategyCodeImplementationVisibility; -extern const char* const s_streamInternalsCreateFIFOCode; -extern const int s_streamInternalsCreateFIFOCodeLength; -extern const JSC::ConstructAbility s_streamInternalsCreateFIFOCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsCreateFIFOCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsCreateFIFOCodeImplementationVisibility; -extern const char* const s_streamInternalsNewQueueCode; -extern const int s_streamInternalsNewQueueCodeLength; -extern const JSC::ConstructAbility s_streamInternalsNewQueueCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsNewQueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsNewQueueCodeImplementationVisibility; -extern const char* const s_streamInternalsDequeueValueCode; -extern const int s_streamInternalsDequeueValueCodeLength; -extern const JSC::ConstructAbility s_streamInternalsDequeueValueCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsDequeueValueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsDequeueValueCodeImplementationVisibility; -extern const char* const s_streamInternalsEnqueueValueWithSizeCode; -extern const int s_streamInternalsEnqueueValueWithSizeCodeLength; -extern const JSC::ConstructAbility s_streamInternalsEnqueueValueWithSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsEnqueueValueWithSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsEnqueueValueWithSizeCodeImplementationVisibility; -extern const char* const s_streamInternalsPeekQueueValueCode; -extern const int s_streamInternalsPeekQueueValueCodeLength; -extern const JSC::ConstructAbility s_streamInternalsPeekQueueValueCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsPeekQueueValueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsPeekQueueValueCodeImplementationVisibility; -extern const char* const s_streamInternalsResetQueueCode; -extern const int s_streamInternalsResetQueueCodeLength; -extern const JSC::ConstructAbility s_streamInternalsResetQueueCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsResetQueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsResetQueueCodeImplementationVisibility; -extern const char* const s_streamInternalsExtractSizeAlgorithmCode; -extern const int s_streamInternalsExtractSizeAlgorithmCodeLength; -extern const JSC::ConstructAbility s_streamInternalsExtractSizeAlgorithmCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsExtractSizeAlgorithmCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsExtractSizeAlgorithmCodeImplementationVisibility; -extern const char* const s_streamInternalsExtractHighWaterMarkCode; -extern const int s_streamInternalsExtractHighWaterMarkCodeLength; -extern const JSC::ConstructAbility s_streamInternalsExtractHighWaterMarkCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsExtractHighWaterMarkCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsExtractHighWaterMarkCodeImplementationVisibility; -extern const char* const s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCode; -extern const int s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeLength; -extern const JSC::ConstructAbility s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeImplementationVisibility; -extern const char* const s_streamInternalsCreateFulfilledPromiseCode; -extern const int s_streamInternalsCreateFulfilledPromiseCodeLength; -extern const JSC::ConstructAbility s_streamInternalsCreateFulfilledPromiseCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsCreateFulfilledPromiseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsCreateFulfilledPromiseCodeImplementationVisibility; -extern const char* const s_streamInternalsToDictionaryCode; -extern const int s_streamInternalsToDictionaryCodeLength; -extern const JSC::ConstructAbility s_streamInternalsToDictionaryCodeConstructAbility; -extern const JSC::ConstructorKind s_streamInternalsToDictionaryCodeConstructorKind; -extern const JSC::ImplementationVisibility s_streamInternalsToDictionaryCodeImplementationVisibility; - -#define WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_DATA(macro) \ - macro(markPromiseAsHandled, streamInternalsMarkPromiseAsHandled, 1) \ - macro(shieldingPromiseResolve, streamInternalsShieldingPromiseResolve, 1) \ - macro(promiseInvokeOrNoopMethodNoCatch, streamInternalsPromiseInvokeOrNoopMethodNoCatch, 3) \ - macro(promiseInvokeOrNoopNoCatch, streamInternalsPromiseInvokeOrNoopNoCatch, 3) \ - macro(promiseInvokeOrNoopMethod, streamInternalsPromiseInvokeOrNoopMethod, 3) \ - macro(promiseInvokeOrNoop, streamInternalsPromiseInvokeOrNoop, 3) \ - macro(promiseInvokeOrFallbackOrNoop, streamInternalsPromiseInvokeOrFallbackOrNoop, 5) \ - macro(validateAndNormalizeQueuingStrategy, streamInternalsValidateAndNormalizeQueuingStrategy, 2) \ - macro(createFIFO, streamInternalsCreateFIFO, 0) \ - macro(newQueue, streamInternalsNewQueue, 0) \ - macro(dequeueValue, streamInternalsDequeueValue, 1) \ - macro(enqueueValueWithSize, streamInternalsEnqueueValueWithSize, 3) \ - macro(peekQueueValue, streamInternalsPeekQueueValue, 1) \ - macro(resetQueue, streamInternalsResetQueue, 1) \ - macro(extractSizeAlgorithm, streamInternalsExtractSizeAlgorithm, 1) \ - macro(extractHighWaterMark, streamInternalsExtractHighWaterMark, 2) \ - macro(extractHighWaterMarkFromQueuingStrategyInit, streamInternalsExtractHighWaterMarkFromQueuingStrategyInit, 1) \ - macro(createFulfilledPromise, streamInternalsCreateFulfilledPromise, 1) \ - macro(toDictionary, streamInternalsToDictionary, 3) \ - -#define WEBCORE_BUILTIN_STREAMINTERNALS_MARKPROMISEASHANDLED 1 -#define WEBCORE_BUILTIN_STREAMINTERNALS_SHIELDINGPROMISERESOLVE 1 -#define WEBCORE_BUILTIN_STREAMINTERNALS_PROMISEINVOKEORNOOPMETHODNOCATCH 1 -#define WEBCORE_BUILTIN_STREAMINTERNALS_PROMISEINVOKEORNOOPNOCATCH 1 -#define WEBCORE_BUILTIN_STREAMINTERNALS_PROMISEINVOKEORNOOPMETHOD 1 -#define WEBCORE_BUILTIN_STREAMINTERNALS_PROMISEINVOKEORNOOP 1 -#define WEBCORE_BUILTIN_STREAMINTERNALS_PROMISEINVOKEORFALLBACKORNOOP 1 -#define WEBCORE_BUILTIN_STREAMINTERNALS_VALIDATEANDNORMALIZEQUEUINGSTRATEGY 1 -#define WEBCORE_BUILTIN_STREAMINTERNALS_CREATEFIFO 1 -#define WEBCORE_BUILTIN_STREAMINTERNALS_NEWQUEUE 1 -#define WEBCORE_BUILTIN_STREAMINTERNALS_DEQUEUEVALUE 1 -#define WEBCORE_BUILTIN_STREAMINTERNALS_ENQUEUEVALUEWITHSIZE 1 -#define WEBCORE_BUILTIN_STREAMINTERNALS_PEEKQUEUEVALUE 1 -#define WEBCORE_BUILTIN_STREAMINTERNALS_RESETQUEUE 1 -#define WEBCORE_BUILTIN_STREAMINTERNALS_EXTRACTSIZEALGORITHM 1 -#define WEBCORE_BUILTIN_STREAMINTERNALS_EXTRACTHIGHWATERMARK 1 -#define WEBCORE_BUILTIN_STREAMINTERNALS_EXTRACTHIGHWATERMARKFROMQUEUINGSTRATEGYINIT 1 -#define WEBCORE_BUILTIN_STREAMINTERNALS_CREATEFULFILLEDPROMISE 1 -#define WEBCORE_BUILTIN_STREAMINTERNALS_TODICTIONARY 1 - -#define WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_CODE(macro) \ - macro(streamInternalsMarkPromiseAsHandledCode, markPromiseAsHandled, ASCIILiteral(), s_streamInternalsMarkPromiseAsHandledCodeLength) \ - macro(streamInternalsShieldingPromiseResolveCode, shieldingPromiseResolve, ASCIILiteral(), s_streamInternalsShieldingPromiseResolveCodeLength) \ - macro(streamInternalsPromiseInvokeOrNoopMethodNoCatchCode, promiseInvokeOrNoopMethodNoCatch, ASCIILiteral(), s_streamInternalsPromiseInvokeOrNoopMethodNoCatchCodeLength) \ - macro(streamInternalsPromiseInvokeOrNoopNoCatchCode, promiseInvokeOrNoopNoCatch, ASCIILiteral(), s_streamInternalsPromiseInvokeOrNoopNoCatchCodeLength) \ - macro(streamInternalsPromiseInvokeOrNoopMethodCode, promiseInvokeOrNoopMethod, ASCIILiteral(), s_streamInternalsPromiseInvokeOrNoopMethodCodeLength) \ - macro(streamInternalsPromiseInvokeOrNoopCode, promiseInvokeOrNoop, ASCIILiteral(), s_streamInternalsPromiseInvokeOrNoopCodeLength) \ - macro(streamInternalsPromiseInvokeOrFallbackOrNoopCode, promiseInvokeOrFallbackOrNoop, ASCIILiteral(), s_streamInternalsPromiseInvokeOrFallbackOrNoopCodeLength) \ - macro(streamInternalsValidateAndNormalizeQueuingStrategyCode, validateAndNormalizeQueuingStrategy, ASCIILiteral(), s_streamInternalsValidateAndNormalizeQueuingStrategyCodeLength) \ - macro(streamInternalsCreateFIFOCode, createFIFO, ASCIILiteral(), s_streamInternalsCreateFIFOCodeLength) \ - macro(streamInternalsNewQueueCode, newQueue, ASCIILiteral(), s_streamInternalsNewQueueCodeLength) \ - macro(streamInternalsDequeueValueCode, dequeueValue, ASCIILiteral(), s_streamInternalsDequeueValueCodeLength) \ - macro(streamInternalsEnqueueValueWithSizeCode, enqueueValueWithSize, ASCIILiteral(), s_streamInternalsEnqueueValueWithSizeCodeLength) \ - macro(streamInternalsPeekQueueValueCode, peekQueueValue, ASCIILiteral(), s_streamInternalsPeekQueueValueCodeLength) \ - macro(streamInternalsResetQueueCode, resetQueue, ASCIILiteral(), s_streamInternalsResetQueueCodeLength) \ - macro(streamInternalsExtractSizeAlgorithmCode, extractSizeAlgorithm, ASCIILiteral(), s_streamInternalsExtractSizeAlgorithmCodeLength) \ - macro(streamInternalsExtractHighWaterMarkCode, extractHighWaterMark, ASCIILiteral(), s_streamInternalsExtractHighWaterMarkCodeLength) \ - macro(streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCode, extractHighWaterMarkFromQueuingStrategyInit, ASCIILiteral(), s_streamInternalsExtractHighWaterMarkFromQueuingStrategyInitCodeLength) \ - macro(streamInternalsCreateFulfilledPromiseCode, createFulfilledPromise, ASCIILiteral(), s_streamInternalsCreateFulfilledPromiseCodeLength) \ - macro(streamInternalsToDictionaryCode, toDictionary, ASCIILiteral(), s_streamInternalsToDictionaryCodeLength) \ - -#define WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_FUNCTION_NAME(macro) \ - macro(createFIFO) \ - macro(createFulfilledPromise) \ - macro(dequeueValue) \ - macro(enqueueValueWithSize) \ - macro(extractHighWaterMark) \ - macro(extractHighWaterMarkFromQueuingStrategyInit) \ - macro(extractSizeAlgorithm) \ - macro(markPromiseAsHandled) \ - macro(newQueue) \ - macro(peekQueueValue) \ - macro(promiseInvokeOrFallbackOrNoop) \ - macro(promiseInvokeOrNoop) \ - macro(promiseInvokeOrNoopMethod) \ - macro(promiseInvokeOrNoopMethodNoCatch) \ - macro(promiseInvokeOrNoopNoCatch) \ - macro(resetQueue) \ - macro(shieldingPromiseResolve) \ - macro(toDictionary) \ - macro(validateAndNormalizeQueuingStrategy) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class StreamInternalsBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit StreamInternalsBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* StreamInternalsBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void StreamInternalsBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -class StreamInternalsBuiltinFunctions { -public: - explicit StreamInternalsBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { } - - void init(JSC::JSGlobalObject&); - template<typename Visitor> void visit(Visitor&); - -public: - JSC::VM& m_vm; - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \ - JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function; - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS -}; - -inline void StreamInternalsBuiltinFunctions::init(JSC::JSGlobalObject& globalObject) -{ -#define EXPORT_FUNCTION(codeName, functionName, overriddenName, length)\ - m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject)); - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_CODE(EXPORT_FUNCTION) -#undef EXPORT_FUNCTION -} - -template<typename Visitor> -inline void StreamInternalsBuiltinFunctions::visit(Visitor& visitor) -{ -#define VISIT_FUNCTION(name) visitor.append(m_##name##Function); - WEBCORE_FOREACH_STREAMINTERNALS_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION) -#undef VISIT_FUNCTION -} - -template void StreamInternalsBuiltinFunctions::visit(JSC::AbstractSlotVisitor&); -template void StreamInternalsBuiltinFunctions::visit(JSC::SlotVisitor&); - - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/TransformStreamBuiltins.cpp b/src/bun.js/builtins/cpp/TransformStreamBuiltins.cpp deleted file mode 100644 index 7552cc5b0..000000000 --- a/src/bun.js/builtins/cpp/TransformStreamBuiltins.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "TransformStreamBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_transformStreamInitializeTransformStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInitializeTransformStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInitializeTransformStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInitializeTransformStreamCodeLength = 2727; -static const JSC::Intrinsic s_transformStreamInitializeTransformStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInitializeTransformStreamCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " let transformer = arguments[0];\n" \ - "\n" \ - " //\n" \ - " if (@isObject(transformer) && @getByIdDirectPrivate(transformer, \"TransformStream\"))\n" \ - " return this;\n" \ - "\n" \ - " let writableStrategy = arguments[1];\n" \ - " let readableStrategy = arguments[2];\n" \ - "\n" \ - " if (transformer === @undefined)\n" \ - " transformer = null;\n" \ - "\n" \ - " if (readableStrategy === @undefined)\n" \ - " readableStrategy = { };\n" \ - "\n" \ - " if (writableStrategy === @undefined)\n" \ - " writableStrategy = { };\n" \ - "\n" \ - " let transformerDict = { };\n" \ - " if (transformer !== null) {\n" \ - " if (\"start\" in transformer) {\n" \ - " transformerDict[\"start\"] = transformer[\"start\"];\n" \ - " if (typeof transformerDict[\"start\"] !== \"function\")\n" \ - " @throwTypeError(\"transformer.start should be a function\");\n" \ - " }\n" \ - " if (\"transform\" in transformer) {\n" \ - " transformerDict[\"transform\"] = transformer[\"transform\"];\n" \ - " if (typeof transformerDict[\"transform\"] !== \"function\")\n" \ - " @throwTypeError(\"transformer.transform should be a function\");\n" \ - " }\n" \ - " if (\"flush\" in transformer) {\n" \ - " transformerDict[\"flush\"] = transformer[\"flush\"];\n" \ - " if (typeof transformerDict[\"flush\"] !== \"function\")\n" \ - " @throwTypeError(\"transformer.flush should be a function\");\n" \ - " }\n" \ - "\n" \ - " if (\"readableType\" in transformer)\n" \ - " @throwRangeError(\"TransformStream transformer has a readableType\");\n" \ - " if (\"writableType\" in transformer)\n" \ - " @throwRangeError(\"TransformStream transformer has a writableType\");\n" \ - " }\n" \ - "\n" \ - " const readableHighWaterMark = @extractHighWaterMark(readableStrategy, 0);\n" \ - " const readableSizeAlgorithm = @extractSizeAlgorithm(readableStrategy);\n" \ - "\n" \ - " const writableHighWaterMark = @extractHighWaterMark(writableStrategy, 1);\n" \ - " const writableSizeAlgorithm = @extractSizeAlgorithm(writableStrategy);\n" \ - "\n" \ - " const startPromiseCapability = @newPromiseCapability(@Promise);\n" \ - " @initializeTransformStream(this, startPromiseCapability.@promise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm);\n" \ - " @setUpTransformStreamDefaultControllerFromTransformer(this, transformer, transformerDict);\n" \ - "\n" \ - " if (\"start\" in transformerDict) {\n" \ - " const controller = @getByIdDirectPrivate(this, \"controller\");\n" \ - " const startAlgorithm = () => @promiseInvokeOrNoopMethodNoCatch(transformer, transformerDict[\"start\"], [controller]);\n" \ - " startAlgorithm().@then(() => {\n" \ - " //\n" \ - " startPromiseCapability.@resolve.@call();\n" \ - " }, (error) => {\n" \ - " startPromiseCapability.@reject.@call(@undefined, error);\n" \ - " });\n" \ - " } else\n" \ - " startPromiseCapability.@resolve.@call();\n" \ - "\n" \ - " return this;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamReadableCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamReadableCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamReadableCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamReadableCodeLength = 190; -static const JSC::Intrinsic s_transformStreamReadableCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamReadableCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isTransformStream(this))\n" \ - " throw @makeThisTypeError(\"TransformStream\", \"readable\");\n" \ - "\n" \ - " return @getByIdDirectPrivate(this, \"readable\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamWritableCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamWritableCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamWritableCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamWritableCodeLength = 190; -static const JSC::Intrinsic s_transformStreamWritableCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamWritableCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isTransformStream(this))\n" \ - " throw @makeThisTypeError(\"TransformStream\", \"writable\");\n" \ - "\n" \ - " return @getByIdDirectPrivate(this, \"writable\");\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().transformStreamBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().transformStreamBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/TransformStreamBuiltins.h b/src/bun.js/builtins/cpp/TransformStreamBuiltins.h deleted file mode 100644 index 68b36206a..000000000 --- a/src/bun.js/builtins/cpp/TransformStreamBuiltins.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* TransformStream */ -extern const char* const s_transformStreamInitializeTransformStreamCode; -extern const int s_transformStreamInitializeTransformStreamCodeLength; -extern const JSC::ConstructAbility s_transformStreamInitializeTransformStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInitializeTransformStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInitializeTransformStreamCodeImplementationVisibility; -extern const char* const s_transformStreamReadableCode; -extern const int s_transformStreamReadableCodeLength; -extern const JSC::ConstructAbility s_transformStreamReadableCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamReadableCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamReadableCodeImplementationVisibility; -extern const char* const s_transformStreamWritableCode; -extern const int s_transformStreamWritableCodeLength; -extern const JSC::ConstructAbility s_transformStreamWritableCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamWritableCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamWritableCodeImplementationVisibility; - -#define WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_DATA(macro) \ - macro(initializeTransformStream, transformStreamInitializeTransformStream, 0) \ - macro(readable, transformStreamReadable, 0) \ - macro(writable, transformStreamWritable, 0) \ - -#define WEBCORE_BUILTIN_TRANSFORMSTREAM_INITIALIZETRANSFORMSTREAM 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAM_READABLE 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAM_WRITABLE 1 - -#define WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_CODE(macro) \ - macro(transformStreamInitializeTransformStreamCode, initializeTransformStream, ASCIILiteral(), s_transformStreamInitializeTransformStreamCodeLength) \ - macro(transformStreamReadableCode, readable, "get readable"_s, s_transformStreamReadableCodeLength) \ - macro(transformStreamWritableCode, writable, ASCIILiteral(), s_transformStreamWritableCodeLength) \ - -#define WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_FUNCTION_NAME(macro) \ - macro(initializeTransformStream) \ - macro(readable) \ - macro(writable) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class TransformStreamBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit TransformStreamBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* TransformStreamBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void TransformStreamBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_TRANSFORMSTREAM_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/TransformStreamDefaultControllerBuiltins.cpp b/src/bun.js/builtins/cpp/TransformStreamDefaultControllerBuiltins.cpp deleted file mode 100644 index 696d11c80..000000000 --- a/src/bun.js/builtins/cpp/TransformStreamDefaultControllerBuiltins.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "TransformStreamDefaultControllerBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeLength = 54; -static const JSC::Intrinsic s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " return this;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamDefaultControllerDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamDefaultControllerDesiredSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamDefaultControllerDesiredSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamDefaultControllerDesiredSizeCodeLength = 465; -static const JSC::Intrinsic s_transformStreamDefaultControllerDesiredSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamDefaultControllerDesiredSizeCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isTransformStreamDefaultController(this))\n" \ - " throw @makeThisTypeError(\"TransformStreamDefaultController\", \"enqueue\");\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(this, \"stream\");\n" \ - " const readable = @getByIdDirectPrivate(stream, \"readable\");\n" \ - " const readableController = @getByIdDirectPrivate(readable, \"readableStreamController\");\n" \ - "\n" \ - " return @readableStreamDefaultControllerGetDesiredSize(readableController);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamDefaultControllerEnqueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamDefaultControllerEnqueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamDefaultControllerEnqueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamDefaultControllerEnqueueCodeLength = 235; -static const JSC::Intrinsic s_transformStreamDefaultControllerEnqueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamDefaultControllerEnqueueCode = - "(function (chunk)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isTransformStreamDefaultController(this))\n" \ - " throw @makeThisTypeError(\"TransformStreamDefaultController\", \"enqueue\");\n" \ - "\n" \ - " @transformStreamDefaultControllerEnqueue(this, chunk);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamDefaultControllerErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamDefaultControllerErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamDefaultControllerErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamDefaultControllerErrorCodeLength = 223; -static const JSC::Intrinsic s_transformStreamDefaultControllerErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamDefaultControllerErrorCode = - "(function (e)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isTransformStreamDefaultController(this))\n" \ - " throw @makeThisTypeError(\"TransformStreamDefaultController\", \"error\");\n" \ - "\n" \ - " @transformStreamDefaultControllerError(this, e);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamDefaultControllerTerminateCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamDefaultControllerTerminateCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamDefaultControllerTerminateCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamDefaultControllerTerminateCodeLength = 227; -static const JSC::Intrinsic s_transformStreamDefaultControllerTerminateCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamDefaultControllerTerminateCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isTransformStreamDefaultController(this))\n" \ - " throw @makeThisTypeError(\"TransformStreamDefaultController\", \"terminate\");\n" \ - "\n" \ - " @transformStreamDefaultControllerTerminate(this);\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().transformStreamDefaultControllerBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().transformStreamDefaultControllerBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/TransformStreamDefaultControllerBuiltins.h b/src/bun.js/builtins/cpp/TransformStreamDefaultControllerBuiltins.h deleted file mode 100644 index b0b75cda8..000000000 --- a/src/bun.js/builtins/cpp/TransformStreamDefaultControllerBuiltins.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* TransformStreamDefaultController */ -extern const char* const s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCode; -extern const int s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeLength; -extern const JSC::ConstructAbility s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeImplementationVisibility; -extern const char* const s_transformStreamDefaultControllerDesiredSizeCode; -extern const int s_transformStreamDefaultControllerDesiredSizeCodeLength; -extern const JSC::ConstructAbility s_transformStreamDefaultControllerDesiredSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamDefaultControllerDesiredSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamDefaultControllerDesiredSizeCodeImplementationVisibility; -extern const char* const s_transformStreamDefaultControllerEnqueueCode; -extern const int s_transformStreamDefaultControllerEnqueueCodeLength; -extern const JSC::ConstructAbility s_transformStreamDefaultControllerEnqueueCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamDefaultControllerEnqueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamDefaultControllerEnqueueCodeImplementationVisibility; -extern const char* const s_transformStreamDefaultControllerErrorCode; -extern const int s_transformStreamDefaultControllerErrorCodeLength; -extern const JSC::ConstructAbility s_transformStreamDefaultControllerErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamDefaultControllerErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamDefaultControllerErrorCodeImplementationVisibility; -extern const char* const s_transformStreamDefaultControllerTerminateCode; -extern const int s_transformStreamDefaultControllerTerminateCodeLength; -extern const JSC::ConstructAbility s_transformStreamDefaultControllerTerminateCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamDefaultControllerTerminateCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamDefaultControllerTerminateCodeImplementationVisibility; - -#define WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_DATA(macro) \ - macro(initializeTransformStreamDefaultController, transformStreamDefaultControllerInitializeTransformStreamDefaultController, 0) \ - macro(desiredSize, transformStreamDefaultControllerDesiredSize, 0) \ - macro(enqueue, transformStreamDefaultControllerEnqueue, 1) \ - macro(error, transformStreamDefaultControllerError, 1) \ - macro(terminate, transformStreamDefaultControllerTerminate, 0) \ - -#define WEBCORE_BUILTIN_TRANSFORMSTREAMDEFAULTCONTROLLER_INITIALIZETRANSFORMSTREAMDEFAULTCONTROLLER 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMDEFAULTCONTROLLER_DESIREDSIZE 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMDEFAULTCONTROLLER_ENQUEUE 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMDEFAULTCONTROLLER_ERROR 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMDEFAULTCONTROLLER_TERMINATE 1 - -#define WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_CODE(macro) \ - macro(transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCode, initializeTransformStreamDefaultController, ASCIILiteral(), s_transformStreamDefaultControllerInitializeTransformStreamDefaultControllerCodeLength) \ - macro(transformStreamDefaultControllerDesiredSizeCode, desiredSize, "get desiredSize"_s, s_transformStreamDefaultControllerDesiredSizeCodeLength) \ - macro(transformStreamDefaultControllerEnqueueCode, enqueue, ASCIILiteral(), s_transformStreamDefaultControllerEnqueueCodeLength) \ - macro(transformStreamDefaultControllerErrorCode, error, ASCIILiteral(), s_transformStreamDefaultControllerErrorCodeLength) \ - macro(transformStreamDefaultControllerTerminateCode, terminate, ASCIILiteral(), s_transformStreamDefaultControllerTerminateCodeLength) \ - -#define WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(macro) \ - macro(desiredSize) \ - macro(enqueue) \ - macro(error) \ - macro(initializeTransformStreamDefaultController) \ - macro(terminate) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class TransformStreamDefaultControllerBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit TransformStreamDefaultControllerBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* TransformStreamDefaultControllerBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void TransformStreamDefaultControllerBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_TRANSFORMSTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/TransformStreamInternalsBuiltins.cpp b/src/bun.js/builtins/cpp/TransformStreamInternalsBuiltins.cpp deleted file mode 100644 index 329eb52ea..000000000 --- a/src/bun.js/builtins/cpp/TransformStreamInternalsBuiltins.cpp +++ /dev/null @@ -1,508 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "TransformStreamInternalsBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_transformStreamInternalsIsTransformStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsIsTransformStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsIsTransformStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsIsTransformStreamCodeLength = 120; -static const JSC::Intrinsic s_transformStreamInternalsIsTransformStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsIsTransformStreamCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " return @isObject(stream) && !!@getByIdDirectPrivate(stream, \"readable\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamInternalsIsTransformStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsIsTransformStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsIsTransformStreamDefaultControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsIsTransformStreamDefaultControllerCodeLength = 142; -static const JSC::Intrinsic s_transformStreamInternalsIsTransformStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsIsTransformStreamDefaultControllerCode = - "(function (controller)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " return @isObject(controller) && !!@getByIdDirectPrivate(controller, \"transformAlgorithm\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamInternalsCreateTransformStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsCreateTransformStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsCreateTransformStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsCreateTransformStreamCodeLength = 1317; -static const JSC::Intrinsic s_transformStreamInternalsCreateTransformStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsCreateTransformStreamCode = - "(function (startAlgorithm, transformAlgorithm, flushAlgorithm, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm)\n" \ - "{\n" \ - " if (writableHighWaterMark === @undefined)\n" \ - " writableHighWaterMark = 1;\n" \ - " if (writableSizeAlgorithm === @undefined)\n" \ - " writableSizeAlgorithm = () => 1;\n" \ - " if (readableHighWaterMark === @undefined)\n" \ - " readableHighWaterMark = 0;\n" \ - " if (readableSizeAlgorithm === @undefined)\n" \ - " readableSizeAlgorithm = () => 1;\n" \ - " @assert(writableHighWaterMark >= 0);\n" \ - " @assert(readableHighWaterMark >= 0);\n" \ - "\n" \ - " const transform = {};\n" \ - " @putByIdDirectPrivate(transform, \"TransformStream\", true);\n" \ - "\n" \ - " const stream = new @TransformStream(transform);\n" \ - " const startPromiseCapability = @newPromiseCapability(@Promise);\n" \ - " @initializeTransformStream(stream, startPromiseCapability.@promise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm);\n" \ - "\n" \ - " const controller = new @TransformStreamDefaultController();\n" \ - " @setUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm);\n" \ - "\n" \ - " startAlgorithm().@then(() => {\n" \ - " startPromiseCapability.@resolve.@call();\n" \ - " }, (error) => {\n" \ - " startPromiseCapability.@reject.@call(@undefined, error);\n" \ - " });\n" \ - "\n" \ - " return stream;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamInternalsInitializeTransformStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsInitializeTransformStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsInitializeTransformStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsInitializeTransformStreamCodeLength = 1881; -static const JSC::Intrinsic s_transformStreamInternalsInitializeTransformStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsInitializeTransformStreamCode = - "(function (stream, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const startAlgorithm = () => { return startPromise; };\n" \ - " const writeAlgorithm = (chunk) => { return @transformStreamDefaultSinkWriteAlgorithm(stream, chunk); }\n" \ - " const abortAlgorithm = (reason) => { return @transformStreamDefaultSinkAbortAlgorithm(stream, reason); }\n" \ - " const closeAlgorithm = () => { return @transformStreamDefaultSinkCloseAlgorithm(stream); }\n" \ - " const writable = @createWritableStream(startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, writableHighWaterMark, writableSizeAlgorithm);\n" \ - "\n" \ - " const pullAlgorithm = () => { return @transformStreamDefaultSourcePullAlgorithm(stream); };\n" \ - " const cancelAlgorithm = (reason) => {\n" \ - " @transformStreamErrorWritableAndUnblockWrite(stream, reason);\n" \ - " return @Promise.@resolve();\n" \ - " };\n" \ - " const underlyingSource = { };\n" \ - " @putByIdDirectPrivate(underlyingSource, \"start\", startAlgorithm);\n" \ - " @putByIdDirectPrivate(underlyingSource, \"pull\", pullAlgorithm);\n" \ - " @putByIdDirectPrivate(underlyingSource, \"cancel\", cancelAlgorithm);\n" \ - " const options = { };\n" \ - " @putByIdDirectPrivate(options, \"size\", readableSizeAlgorithm);\n" \ - " @putByIdDirectPrivate(options, \"highWaterMark\", readableHighWaterMark);\n" \ - " const readable = new @ReadableStream(underlyingSource, options);\n" \ - "\n" \ - " //\n" \ - " @putByIdDirectPrivate(stream, \"writable\", writable);\n" \ - " //\n" \ - " @putByIdDirectPrivate(stream, \"internalWritable\", @getInternalWritableStream(writable));\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"readable\", readable);\n" \ - " @putByIdDirectPrivate(stream, \"backpressure\", @undefined);\n" \ - " @putByIdDirectPrivate(stream, \"backpressureChangePromise\", @undefined);\n" \ - "\n" \ - " @transformStreamSetBackpressure(stream, true);\n" \ - " @putByIdDirectPrivate(stream, \"controller\", @undefined);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamErrorCodeLength = 330; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamErrorCode = - "(function (stream, e)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const readable = @getByIdDirectPrivate(stream, \"readable\");\n" \ - " const readableController = @getByIdDirectPrivate(readable, \"readableStreamController\");\n" \ - " @readableStreamDefaultControllerError(readableController, e);\n" \ - "\n" \ - " @transformStreamErrorWritableAndUnblockWrite(stream, e);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeLength = 431; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCode = - "(function (stream, e)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @transformStreamDefaultControllerClearAlgorithms(@getByIdDirectPrivate(stream, \"controller\"));\n" \ - "\n" \ - " const writable = @getByIdDirectPrivate(stream, \"internalWritable\");\n" \ - " @writableStreamDefaultControllerErrorIfNeeded(@getByIdDirectPrivate(writable, \"controller\"), e);\n" \ - "\n" \ - " if (@getByIdDirectPrivate(stream, \"backpressure\"))\n" \ - " @transformStreamSetBackpressure(stream, false);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamSetBackpressureCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamSetBackpressureCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamSetBackpressureCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamSetBackpressureCodeLength = 498; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamSetBackpressureCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamSetBackpressureCode = - "(function (stream, backpressure)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@getByIdDirectPrivate(stream, \"backpressure\") !== backpressure);\n" \ - "\n" \ - " const backpressureChangePromise = @getByIdDirectPrivate(stream, \"backpressureChangePromise\");\n" \ - " if (backpressureChangePromise !== @undefined)\n" \ - " backpressureChangePromise.@resolve.@call();\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"backpressureChangePromise\", @newPromiseCapability(@Promise));\n" \ - " @putByIdDirectPrivate(stream, \"backpressure\", backpressure);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeLength = 478; -static const JSC::Intrinsic s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsSetUpTransformStreamDefaultControllerCode = - "(function (stream, controller, transformAlgorithm, flushAlgorithm)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@isTransformStream(stream));\n" \ - " @assert(@getByIdDirectPrivate(stream, \"controller\") === @undefined);\n" \ - "\n" \ - " @putByIdDirectPrivate(controller, \"stream\", stream);\n" \ - " @putByIdDirectPrivate(stream, \"controller\", controller);\n" \ - " @putByIdDirectPrivate(controller, \"transformAlgorithm\", transformAlgorithm);\n" \ - " @putByIdDirectPrivate(controller, \"flushAlgorithm\", flushAlgorithm);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeLength = 940; -static const JSC::Intrinsic s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCode = - "(function (stream, transformer, transformerDict)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const controller = new @TransformStreamDefaultController();\n" \ - " let transformAlgorithm = (chunk) => {\n" \ - " try {\n" \ - " @transformStreamDefaultControllerEnqueue(controller, chunk);\n" \ - " } catch (e) {\n" \ - " return @Promise.@reject(e);\n" \ - " }\n" \ - " return @Promise.@resolve();\n" \ - " };\n" \ - " let flushAlgorithm = () => { return @Promise.@resolve(); };\n" \ - "\n" \ - " if (\"transform\" in transformerDict)\n" \ - " transformAlgorithm = (chunk) => {\n" \ - " return @promiseInvokeOrNoopMethod(transformer, transformerDict[\"transform\"], [chunk, controller]);\n" \ - " };\n" \ - "\n" \ - " if (\"flush\" in transformerDict) {\n" \ - " flushAlgorithm = () => {\n" \ - " return @promiseInvokeOrNoopMethod(transformer, transformerDict[\"flush\"], [controller]);\n" \ - " };\n" \ - " }\n" \ - "\n" \ - " @setUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeLength = 190; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCode = - "(function (controller)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " //\n" \ - " @putByIdDirectPrivate(controller, \"transformAlgorithm\", true);\n" \ - " @putByIdDirectPrivate(controller, \"flushAlgorithm\", @undefined);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeLength = 979; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCode = - "(function (controller, chunk)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(controller, \"stream\");\n" \ - " const readable = @getByIdDirectPrivate(stream, \"readable\");\n" \ - " const readableController = @getByIdDirectPrivate(readable, \"readableStreamController\");\n" \ - "\n" \ - " @assert(readableController !== @undefined);\n" \ - " if (!@readableStreamDefaultControllerCanCloseOrEnqueue(readableController))\n" \ - " @throwTypeError(\"TransformStream.readable cannot close or enqueue\");\n" \ - "\n" \ - " try {\n" \ - " @readableStreamDefaultControllerEnqueue(readableController, chunk);\n" \ - " } catch (e) {\n" \ - " @transformStreamErrorWritableAndUnblockWrite(stream, e);\n" \ - " throw @getByIdDirectPrivate(readable, \"storedError\");\n" \ - " }\n" \ - "\n" \ - " const backpressure = !@readableStreamDefaultControllerShouldCallPull(readableController);\n" \ - " if (backpressure !== @getByIdDirectPrivate(stream, \"backpressure\")) {\n" \ - " @assert(backpressure);\n" \ - " @transformStreamSetBackpressure(stream, true);\n" \ - " }\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeLength = 125; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultControllerErrorCode = - "(function (controller, e)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @transformStreamError(@getByIdDirectPrivate(controller, \"stream\"), e);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeLength = 500; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCode = - "(function (controller, chunk)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const promiseCapability = @newPromiseCapability(@Promise);\n" \ - "\n" \ - " const transformPromise = @getByIdDirectPrivate(controller, \"transformAlgorithm\").@call(@undefined, chunk);\n" \ - " transformPromise.@then(() => {\n" \ - " promiseCapability.@resolve();\n" \ - " }, (r) => {\n" \ - " @transformStreamError(@getByIdDirectPrivate(controller, \"stream\"), r);\n" \ - " promiseCapability.@reject.@call(@undefined, r);\n" \ - " });\n" \ - " return promiseCapability.@promise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeLength = 554; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultControllerTerminateCode = - "(function (controller)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(controller, \"stream\");\n" \ - " const readable = @getByIdDirectPrivate(stream, \"readable\");\n" \ - " const readableController = @getByIdDirectPrivate(readable, \"readableStreamController\");\n" \ - "\n" \ - " //\n" \ - " if (@readableStreamDefaultControllerCanCloseOrEnqueue(readableController))\n" \ - " @readableStreamDefaultControllerClose(readableController);\n" \ - " const error = @makeTypeError(\"the stream has been terminated\");\n" \ - " @transformStreamErrorWritableAndUnblockWrite(stream, error);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeLength = 1373; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCode = - "(function (stream, chunk)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const writable = @getByIdDirectPrivate(stream, \"internalWritable\");\n" \ - "\n" \ - " @assert(@getByIdDirectPrivate(writable, \"state\") === \"writable\");\n" \ - "\n" \ - " const controller = @getByIdDirectPrivate(stream, \"controller\");\n" \ - "\n" \ - " if (@getByIdDirectPrivate(stream, \"backpressure\")) {\n" \ - " const promiseCapability = @newPromiseCapability(@Promise);\n" \ - "\n" \ - " const backpressureChangePromise = @getByIdDirectPrivate(stream, \"backpressureChangePromise\");\n" \ - " @assert(backpressureChangePromise !== @undefined);\n" \ - " backpressureChangePromise.@promise.@then(() => {\n" \ - " const state = @getByIdDirectPrivate(writable, \"state\");\n" \ - " if (state === \"erroring\") {\n" \ - " promiseCapability.@reject.@call(@undefined, @getByIdDirectPrivate(writable, \"storedError\"));\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " @assert(state === \"writable\");\n" \ - " @transformStreamDefaultControllerPerformTransform(controller, chunk).@then(() => {\n" \ - " promiseCapability.@resolve();\n" \ - " }, (e) => {\n" \ - " promiseCapability.@reject.@call(@undefined, e);\n" \ - " });\n" \ - " }, (e) => {\n" \ - " promiseCapability.@reject.@call(@undefined, e);\n" \ - " });\n" \ - "\n" \ - " return promiseCapability.@promise;\n" \ - " }\n" \ - " return @transformStreamDefaultControllerPerformTransform(controller, chunk);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeLength = 126; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCode = - "(function (stream, reason)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @transformStreamError(stream, reason);\n" \ - " return @Promise.@resolve();\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeLength = 1295; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " const readable = @getByIdDirectPrivate(stream, \"readable\");\n" \ - " const controller = @getByIdDirectPrivate(stream, \"controller\");\n" \ - " const readableController = @getByIdDirectPrivate(readable, \"readableStreamController\");\n" \ - "\n" \ - " const flushAlgorithm = @getByIdDirectPrivate(controller, \"flushAlgorithm\");\n" \ - " @assert(flushAlgorithm !== @undefined);\n" \ - " const flushPromise = @getByIdDirectPrivate(controller, \"flushAlgorithm\").@call();\n" \ - " @transformStreamDefaultControllerClearAlgorithms(controller);\n" \ - "\n" \ - " const promiseCapability = @newPromiseCapability(@Promise);\n" \ - " flushPromise.@then(() => {\n" \ - " if (@getByIdDirectPrivate(readable, \"state\") === @streamErrored) {\n" \ - " promiseCapability.@reject.@call(@undefined, @getByIdDirectPrivate(readable, \"storedError\"));\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " //\n" \ - " if (@readableStreamDefaultControllerCanCloseOrEnqueue(readableController))\n" \ - " @readableStreamDefaultControllerClose(readableController);\n" \ - " promiseCapability.@resolve();\n" \ - " }, (r) => {\n" \ - " @transformStreamError(@getByIdDirectPrivate(controller, \"stream\"), r);\n" \ - " promiseCapability.@reject.@call(@undefined, @getByIdDirectPrivate(readable, \"storedError\"));\n" \ - " });\n" \ - " return promiseCapability.@promise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeLength = 325; -static const JSC::Intrinsic s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@getByIdDirectPrivate(stream, \"backpressure\"));\n" \ - " @assert(@getByIdDirectPrivate(stream, \"backpressureChangePromise\") !== @undefined);\n" \ - "\n" \ - " @transformStreamSetBackpressure(stream, false);\n" \ - "\n" \ - " return @getByIdDirectPrivate(stream, \"backpressureChangePromise\").@promise;\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().transformStreamInternalsBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().transformStreamInternalsBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/TransformStreamInternalsBuiltins.h b/src/bun.js/builtins/cpp/TransformStreamInternalsBuiltins.h deleted file mode 100644 index b362896c9..000000000 --- a/src/bun.js/builtins/cpp/TransformStreamInternalsBuiltins.h +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* TransformStreamInternals */ -extern const char* const s_transformStreamInternalsIsTransformStreamCode; -extern const int s_transformStreamInternalsIsTransformStreamCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsIsTransformStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsIsTransformStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsIsTransformStreamCodeImplementationVisibility; -extern const char* const s_transformStreamInternalsIsTransformStreamDefaultControllerCode; -extern const int s_transformStreamInternalsIsTransformStreamDefaultControllerCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsIsTransformStreamDefaultControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsIsTransformStreamDefaultControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsIsTransformStreamDefaultControllerCodeImplementationVisibility; -extern const char* const s_transformStreamInternalsCreateTransformStreamCode; -extern const int s_transformStreamInternalsCreateTransformStreamCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsCreateTransformStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsCreateTransformStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsCreateTransformStreamCodeImplementationVisibility; -extern const char* const s_transformStreamInternalsInitializeTransformStreamCode; -extern const int s_transformStreamInternalsInitializeTransformStreamCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsInitializeTransformStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsInitializeTransformStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsInitializeTransformStreamCodeImplementationVisibility; -extern const char* const s_transformStreamInternalsTransformStreamErrorCode; -extern const int s_transformStreamInternalsTransformStreamErrorCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamErrorCodeImplementationVisibility; -extern const char* const s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCode; -extern const int s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeImplementationVisibility; -extern const char* const s_transformStreamInternalsTransformStreamSetBackpressureCode; -extern const int s_transformStreamInternalsTransformStreamSetBackpressureCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamSetBackpressureCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamSetBackpressureCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamSetBackpressureCodeImplementationVisibility; -extern const char* const s_transformStreamInternalsSetUpTransformStreamDefaultControllerCode; -extern const int s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeImplementationVisibility; -extern const char* const s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCode; -extern const int s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeImplementationVisibility; -extern const char* const s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCode; -extern const int s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeImplementationVisibility; -extern const char* const s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCode; -extern const int s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeImplementationVisibility; -extern const char* const s_transformStreamInternalsTransformStreamDefaultControllerErrorCode; -extern const int s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeImplementationVisibility; -extern const char* const s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCode; -extern const int s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeImplementationVisibility; -extern const char* const s_transformStreamInternalsTransformStreamDefaultControllerTerminateCode; -extern const int s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeImplementationVisibility; -extern const char* const s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCode; -extern const int s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeImplementationVisibility; -extern const char* const s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCode; -extern const int s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeImplementationVisibility; -extern const char* const s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCode; -extern const int s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeImplementationVisibility; -extern const char* const s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCode; -extern const int s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeLength; -extern const JSC::ConstructAbility s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeConstructAbility; -extern const JSC::ConstructorKind s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeConstructorKind; -extern const JSC::ImplementationVisibility s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeImplementationVisibility; - -#define WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_DATA(macro) \ - macro(isTransformStream, transformStreamInternalsIsTransformStream, 1) \ - macro(isTransformStreamDefaultController, transformStreamInternalsIsTransformStreamDefaultController, 1) \ - macro(createTransformStream, transformStreamInternalsCreateTransformStream, 7) \ - macro(initializeTransformStream, transformStreamInternalsInitializeTransformStream, 6) \ - macro(transformStreamError, transformStreamInternalsTransformStreamError, 2) \ - macro(transformStreamErrorWritableAndUnblockWrite, transformStreamInternalsTransformStreamErrorWritableAndUnblockWrite, 2) \ - macro(transformStreamSetBackpressure, transformStreamInternalsTransformStreamSetBackpressure, 2) \ - macro(setUpTransformStreamDefaultController, transformStreamInternalsSetUpTransformStreamDefaultController, 4) \ - macro(setUpTransformStreamDefaultControllerFromTransformer, transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformer, 3) \ - macro(transformStreamDefaultControllerClearAlgorithms, transformStreamInternalsTransformStreamDefaultControllerClearAlgorithms, 1) \ - macro(transformStreamDefaultControllerEnqueue, transformStreamInternalsTransformStreamDefaultControllerEnqueue, 2) \ - macro(transformStreamDefaultControllerError, transformStreamInternalsTransformStreamDefaultControllerError, 2) \ - macro(transformStreamDefaultControllerPerformTransform, transformStreamInternalsTransformStreamDefaultControllerPerformTransform, 2) \ - macro(transformStreamDefaultControllerTerminate, transformStreamInternalsTransformStreamDefaultControllerTerminate, 1) \ - macro(transformStreamDefaultSinkWriteAlgorithm, transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithm, 2) \ - macro(transformStreamDefaultSinkAbortAlgorithm, transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithm, 2) \ - macro(transformStreamDefaultSinkCloseAlgorithm, transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithm, 1) \ - macro(transformStreamDefaultSourcePullAlgorithm, transformStreamInternalsTransformStreamDefaultSourcePullAlgorithm, 1) \ - -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_ISTRANSFORMSTREAM 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_ISTRANSFORMSTREAMDEFAULTCONTROLLER 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_CREATETRANSFORMSTREAM 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_INITIALIZETRANSFORMSTREAM 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMERROR 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMERRORWRITABLEANDUNBLOCKWRITE 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMSETBACKPRESSURE 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_SETUPTRANSFORMSTREAMDEFAULTCONTROLLER 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_SETUPTRANSFORMSTREAMDEFAULTCONTROLLERFROMTRANSFORMER 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMDEFAULTCONTROLLERCLEARALGORITHMS 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMDEFAULTCONTROLLERENQUEUE 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMDEFAULTCONTROLLERERROR 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMDEFAULTCONTROLLERPERFORMTRANSFORM 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMDEFAULTCONTROLLERTERMINATE 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMDEFAULTSINKWRITEALGORITHM 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMDEFAULTSINKABORTALGORITHM 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMDEFAULTSINKCLOSEALGORITHM 1 -#define WEBCORE_BUILTIN_TRANSFORMSTREAMINTERNALS_TRANSFORMSTREAMDEFAULTSOURCEPULLALGORITHM 1 - -#define WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_CODE(macro) \ - macro(transformStreamInternalsIsTransformStreamCode, isTransformStream, ASCIILiteral(), s_transformStreamInternalsIsTransformStreamCodeLength) \ - macro(transformStreamInternalsIsTransformStreamDefaultControllerCode, isTransformStreamDefaultController, ASCIILiteral(), s_transformStreamInternalsIsTransformStreamDefaultControllerCodeLength) \ - macro(transformStreamInternalsCreateTransformStreamCode, createTransformStream, ASCIILiteral(), s_transformStreamInternalsCreateTransformStreamCodeLength) \ - macro(transformStreamInternalsInitializeTransformStreamCode, initializeTransformStream, ASCIILiteral(), s_transformStreamInternalsInitializeTransformStreamCodeLength) \ - macro(transformStreamInternalsTransformStreamErrorCode, transformStreamError, ASCIILiteral(), s_transformStreamInternalsTransformStreamErrorCodeLength) \ - macro(transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCode, transformStreamErrorWritableAndUnblockWrite, ASCIILiteral(), s_transformStreamInternalsTransformStreamErrorWritableAndUnblockWriteCodeLength) \ - macro(transformStreamInternalsTransformStreamSetBackpressureCode, transformStreamSetBackpressure, ASCIILiteral(), s_transformStreamInternalsTransformStreamSetBackpressureCodeLength) \ - macro(transformStreamInternalsSetUpTransformStreamDefaultControllerCode, setUpTransformStreamDefaultController, ASCIILiteral(), s_transformStreamInternalsSetUpTransformStreamDefaultControllerCodeLength) \ - macro(transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCode, setUpTransformStreamDefaultControllerFromTransformer, ASCIILiteral(), s_transformStreamInternalsSetUpTransformStreamDefaultControllerFromTransformerCodeLength) \ - macro(transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCode, transformStreamDefaultControllerClearAlgorithms, ASCIILiteral(), s_transformStreamInternalsTransformStreamDefaultControllerClearAlgorithmsCodeLength) \ - macro(transformStreamInternalsTransformStreamDefaultControllerEnqueueCode, transformStreamDefaultControllerEnqueue, ASCIILiteral(), s_transformStreamInternalsTransformStreamDefaultControllerEnqueueCodeLength) \ - macro(transformStreamInternalsTransformStreamDefaultControllerErrorCode, transformStreamDefaultControllerError, ASCIILiteral(), s_transformStreamInternalsTransformStreamDefaultControllerErrorCodeLength) \ - macro(transformStreamInternalsTransformStreamDefaultControllerPerformTransformCode, transformStreamDefaultControllerPerformTransform, ASCIILiteral(), s_transformStreamInternalsTransformStreamDefaultControllerPerformTransformCodeLength) \ - macro(transformStreamInternalsTransformStreamDefaultControllerTerminateCode, transformStreamDefaultControllerTerminate, ASCIILiteral(), s_transformStreamInternalsTransformStreamDefaultControllerTerminateCodeLength) \ - macro(transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCode, transformStreamDefaultSinkWriteAlgorithm, ASCIILiteral(), s_transformStreamInternalsTransformStreamDefaultSinkWriteAlgorithmCodeLength) \ - macro(transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCode, transformStreamDefaultSinkAbortAlgorithm, ASCIILiteral(), s_transformStreamInternalsTransformStreamDefaultSinkAbortAlgorithmCodeLength) \ - macro(transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCode, transformStreamDefaultSinkCloseAlgorithm, ASCIILiteral(), s_transformStreamInternalsTransformStreamDefaultSinkCloseAlgorithmCodeLength) \ - macro(transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCode, transformStreamDefaultSourcePullAlgorithm, ASCIILiteral(), s_transformStreamInternalsTransformStreamDefaultSourcePullAlgorithmCodeLength) \ - -#define WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_FUNCTION_NAME(macro) \ - macro(createTransformStream) \ - macro(initializeTransformStream) \ - macro(isTransformStream) \ - macro(isTransformStreamDefaultController) \ - macro(setUpTransformStreamDefaultController) \ - macro(setUpTransformStreamDefaultControllerFromTransformer) \ - macro(transformStreamDefaultControllerClearAlgorithms) \ - macro(transformStreamDefaultControllerEnqueue) \ - macro(transformStreamDefaultControllerError) \ - macro(transformStreamDefaultControllerPerformTransform) \ - macro(transformStreamDefaultControllerTerminate) \ - macro(transformStreamDefaultSinkAbortAlgorithm) \ - macro(transformStreamDefaultSinkCloseAlgorithm) \ - macro(transformStreamDefaultSinkWriteAlgorithm) \ - macro(transformStreamDefaultSourcePullAlgorithm) \ - macro(transformStreamError) \ - macro(transformStreamErrorWritableAndUnblockWrite) \ - macro(transformStreamSetBackpressure) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class TransformStreamInternalsBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit TransformStreamInternalsBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* TransformStreamInternalsBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void TransformStreamInternalsBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -class TransformStreamInternalsBuiltinFunctions { -public: - explicit TransformStreamInternalsBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { } - - void init(JSC::JSGlobalObject&); - template<typename Visitor> void visit(Visitor&); - -public: - JSC::VM& m_vm; - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \ - JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function; - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS -}; - -inline void TransformStreamInternalsBuiltinFunctions::init(JSC::JSGlobalObject& globalObject) -{ -#define EXPORT_FUNCTION(codeName, functionName, overriddenName, length)\ - m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject)); - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_CODE(EXPORT_FUNCTION) -#undef EXPORT_FUNCTION -} - -template<typename Visitor> -inline void TransformStreamInternalsBuiltinFunctions::visit(Visitor& visitor) -{ -#define VISIT_FUNCTION(name) visitor.append(m_##name##Function); - WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION) -#undef VISIT_FUNCTION -} - -template void TransformStreamInternalsBuiltinFunctions::visit(JSC::AbstractSlotVisitor&); -template void TransformStreamInternalsBuiltinFunctions::visit(JSC::SlotVisitor&); - - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/WebCoreJSBuiltinInternals.h b/src/bun.js/builtins/cpp/WebCoreJSBuiltinInternals.h deleted file mode 100644 index fde4bb97e..000000000 --- a/src/bun.js/builtins/cpp/WebCoreJSBuiltinInternals.h +++ /dev/null @@ -1,76 +0,0 @@ -// clang-format off -namespace Zig { class GlobalObject; } -#include "root.h" - -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include "ReadableByteStreamInternalsBuiltins.h" -#include "ReadableStreamInternalsBuiltins.h" -#include "StreamInternalsBuiltins.h" -#include "TransformStreamInternalsBuiltins.h" -#include "WritableStreamInternalsBuiltins.h" -#include <JavaScriptCore/VM.h> -#include <JavaScriptCore/WeakInlines.h> - -namespace WebCore { - -using JSDOMGlobalObject = Zig::GlobalObject; - -class JSBuiltinInternalFunctions { -public: - explicit JSBuiltinInternalFunctions(JSC::VM&); - - template<typename Visitor> void visit(Visitor&); - void initialize(JSDOMGlobalObject&); - - ReadableByteStreamInternalsBuiltinFunctions& readableByteStreamInternals() { return m_readableByteStreamInternals; } - ReadableStreamInternalsBuiltinFunctions& readableStreamInternals() { return m_readableStreamInternals; } - StreamInternalsBuiltinFunctions& streamInternals() { return m_streamInternals; } - TransformStreamInternalsBuiltinFunctions& transformStreamInternals() { return m_transformStreamInternals; } - WritableStreamInternalsBuiltinFunctions& writableStreamInternals() { return m_writableStreamInternals; } - -private: - JSC::VM& m_vm; - ReadableByteStreamInternalsBuiltinFunctions m_readableByteStreamInternals; - ReadableStreamInternalsBuiltinFunctions m_readableStreamInternals; - StreamInternalsBuiltinFunctions m_streamInternals; - TransformStreamInternalsBuiltinFunctions m_transformStreamInternals; - WritableStreamInternalsBuiltinFunctions m_writableStreamInternals; -}; - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/WebCoreJSBuiltins.h b/src/bun.js/builtins/cpp/WebCoreJSBuiltins.h deleted file mode 100644 index 63a375248..000000000 --- a/src/bun.js/builtins/cpp/WebCoreJSBuiltins.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include "BundlerPluginBuiltins.h" -#include "ByteLengthQueuingStrategyBuiltins.h" -#include "ConsoleObjectBuiltins.h" -#include "CountQueuingStrategyBuiltins.h" -#include "ImportMetaObjectBuiltins.h" -#include "JSBufferConstructorBuiltins.h" -#include "JSBufferPrototypeBuiltins.h" -#include "ProcessObjectInternalsBuiltins.h" -#include "ReadableByteStreamControllerBuiltins.h" -#include "ReadableByteStreamInternalsBuiltins.h" -#include "ReadableStreamBYOBReaderBuiltins.h" -#include "ReadableStreamBYOBRequestBuiltins.h" -#include "ReadableStreamBuiltins.h" -#include "ReadableStreamDefaultControllerBuiltins.h" -#include "ReadableStreamDefaultReaderBuiltins.h" -#include "ReadableStreamInternalsBuiltins.h" -#include "StreamInternalsBuiltins.h" -#include "TransformStreamBuiltins.h" -#include "TransformStreamDefaultControllerBuiltins.h" -#include "TransformStreamInternalsBuiltins.h" -#include "WritableStreamDefaultControllerBuiltins.h" -#include "WritableStreamDefaultWriterBuiltins.h" -#include "WritableStreamInternalsBuiltins.h" -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -class JSBuiltinFunctions { -public: - explicit JSBuiltinFunctions(JSC::VM& vm) - : m_vm(vm) - , m_bundlerPluginBuiltins(m_vm) - , m_byteLengthQueuingStrategyBuiltins(m_vm) - , m_consoleObjectBuiltins(m_vm) - , m_countQueuingStrategyBuiltins(m_vm) - , m_importMetaObjectBuiltins(m_vm) - , m_jsBufferConstructorBuiltins(m_vm) - , m_jsBufferPrototypeBuiltins(m_vm) - , m_processObjectInternalsBuiltins(m_vm) - , m_readableByteStreamControllerBuiltins(m_vm) - , m_readableByteStreamInternalsBuiltins(m_vm) - , m_readableStreamBuiltins(m_vm) - , m_readableStreamBYOBReaderBuiltins(m_vm) - , m_readableStreamBYOBRequestBuiltins(m_vm) - , m_readableStreamDefaultControllerBuiltins(m_vm) - , m_readableStreamDefaultReaderBuiltins(m_vm) - , m_readableStreamInternalsBuiltins(m_vm) - , m_streamInternalsBuiltins(m_vm) - , m_transformStreamBuiltins(m_vm) - , m_transformStreamDefaultControllerBuiltins(m_vm) - , m_transformStreamInternalsBuiltins(m_vm) - , m_writableStreamDefaultControllerBuiltins(m_vm) - , m_writableStreamDefaultWriterBuiltins(m_vm) - , m_writableStreamInternalsBuiltins(m_vm) - { - m_readableByteStreamInternalsBuiltins.exportNames(); - m_readableStreamInternalsBuiltins.exportNames(); - m_streamInternalsBuiltins.exportNames(); - m_transformStreamInternalsBuiltins.exportNames(); - m_writableStreamInternalsBuiltins.exportNames(); - } - - BundlerPluginBuiltinsWrapper& bundlerPluginBuiltins() { return m_bundlerPluginBuiltins; } - ByteLengthQueuingStrategyBuiltinsWrapper& byteLengthQueuingStrategyBuiltins() { return m_byteLengthQueuingStrategyBuiltins; } - ConsoleObjectBuiltinsWrapper& consoleObjectBuiltins() { return m_consoleObjectBuiltins; } - CountQueuingStrategyBuiltinsWrapper& countQueuingStrategyBuiltins() { return m_countQueuingStrategyBuiltins; } - ImportMetaObjectBuiltinsWrapper& importMetaObjectBuiltins() { return m_importMetaObjectBuiltins; } - JSBufferConstructorBuiltinsWrapper& jsBufferConstructorBuiltins() { return m_jsBufferConstructorBuiltins; } - JSBufferPrototypeBuiltinsWrapper& jsBufferPrototypeBuiltins() { return m_jsBufferPrototypeBuiltins; } - ProcessObjectInternalsBuiltinsWrapper& processObjectInternalsBuiltins() { return m_processObjectInternalsBuiltins; } - ReadableByteStreamControllerBuiltinsWrapper& readableByteStreamControllerBuiltins() { return m_readableByteStreamControllerBuiltins; } - ReadableByteStreamInternalsBuiltinsWrapper& readableByteStreamInternalsBuiltins() { return m_readableByteStreamInternalsBuiltins; } - ReadableStreamBuiltinsWrapper& readableStreamBuiltins() { return m_readableStreamBuiltins; } - ReadableStreamBYOBReaderBuiltinsWrapper& readableStreamBYOBReaderBuiltins() { return m_readableStreamBYOBReaderBuiltins; } - ReadableStreamBYOBRequestBuiltinsWrapper& readableStreamBYOBRequestBuiltins() { return m_readableStreamBYOBRequestBuiltins; } - ReadableStreamDefaultControllerBuiltinsWrapper& readableStreamDefaultControllerBuiltins() { return m_readableStreamDefaultControllerBuiltins; } - ReadableStreamDefaultReaderBuiltinsWrapper& readableStreamDefaultReaderBuiltins() { return m_readableStreamDefaultReaderBuiltins; } - ReadableStreamInternalsBuiltinsWrapper& readableStreamInternalsBuiltins() { return m_readableStreamInternalsBuiltins; } - StreamInternalsBuiltinsWrapper& streamInternalsBuiltins() { return m_streamInternalsBuiltins; } - TransformStreamBuiltinsWrapper& transformStreamBuiltins() { return m_transformStreamBuiltins; } - TransformStreamDefaultControllerBuiltinsWrapper& transformStreamDefaultControllerBuiltins() { return m_transformStreamDefaultControllerBuiltins; } - TransformStreamInternalsBuiltinsWrapper& transformStreamInternalsBuiltins() { return m_transformStreamInternalsBuiltins; } - WritableStreamDefaultControllerBuiltinsWrapper& writableStreamDefaultControllerBuiltins() { return m_writableStreamDefaultControllerBuiltins; } - WritableStreamDefaultWriterBuiltinsWrapper& writableStreamDefaultWriterBuiltins() { return m_writableStreamDefaultWriterBuiltins; } - WritableStreamInternalsBuiltinsWrapper& writableStreamInternalsBuiltins() { return m_writableStreamInternalsBuiltins; } - -private: - JSC::VM& m_vm; - BundlerPluginBuiltinsWrapper m_bundlerPluginBuiltins; - ByteLengthQueuingStrategyBuiltinsWrapper m_byteLengthQueuingStrategyBuiltins; - ConsoleObjectBuiltinsWrapper m_consoleObjectBuiltins; - CountQueuingStrategyBuiltinsWrapper m_countQueuingStrategyBuiltins; - ImportMetaObjectBuiltinsWrapper m_importMetaObjectBuiltins; - JSBufferConstructorBuiltinsWrapper m_jsBufferConstructorBuiltins; - JSBufferPrototypeBuiltinsWrapper m_jsBufferPrototypeBuiltins; - ProcessObjectInternalsBuiltinsWrapper m_processObjectInternalsBuiltins; - ReadableByteStreamControllerBuiltinsWrapper m_readableByteStreamControllerBuiltins; - ReadableByteStreamInternalsBuiltinsWrapper m_readableByteStreamInternalsBuiltins; - ReadableStreamBuiltinsWrapper m_readableStreamBuiltins; - ReadableStreamBYOBReaderBuiltinsWrapper m_readableStreamBYOBReaderBuiltins; - ReadableStreamBYOBRequestBuiltinsWrapper m_readableStreamBYOBRequestBuiltins; - ReadableStreamDefaultControllerBuiltinsWrapper m_readableStreamDefaultControllerBuiltins; - ReadableStreamDefaultReaderBuiltinsWrapper m_readableStreamDefaultReaderBuiltins; - ReadableStreamInternalsBuiltinsWrapper m_readableStreamInternalsBuiltins; - StreamInternalsBuiltinsWrapper m_streamInternalsBuiltins; - TransformStreamBuiltinsWrapper m_transformStreamBuiltins; - TransformStreamDefaultControllerBuiltinsWrapper m_transformStreamDefaultControllerBuiltins; - TransformStreamInternalsBuiltinsWrapper m_transformStreamInternalsBuiltins; - WritableStreamDefaultControllerBuiltinsWrapper m_writableStreamDefaultControllerBuiltins; - WritableStreamDefaultWriterBuiltinsWrapper m_writableStreamDefaultWriterBuiltins; - WritableStreamInternalsBuiltinsWrapper m_writableStreamInternalsBuiltins; -}; - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/WritableStreamDefaultControllerBuiltins.cpp b/src/bun.js/builtins/cpp/WritableStreamDefaultControllerBuiltins.cpp deleted file mode 100644 index 9da322b83..000000000 --- a/src/bun.js/builtins/cpp/WritableStreamDefaultControllerBuiltins.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "WritableStreamDefaultControllerBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeLength = 482; -static const JSC::Intrinsic s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @putByIdDirectPrivate(this, \"queue\", @newQueue());\n" \ - " @putByIdDirectPrivate(this, \"abortSteps\", (reason) => {\n" \ - " const result = @getByIdDirectPrivate(this, \"abortAlgorithm\").@call(@undefined, reason);\n" \ - " @writableStreamDefaultControllerClearAlgorithms(this);\n" \ - " return result;\n" \ - " });\n" \ - "\n" \ - " @putByIdDirectPrivate(this, \"errorSteps\", () => {\n" \ - " @resetQueue(@getByIdDirectPrivate(this, \"queue\"));\n" \ - " });\n" \ - "\n" \ - " return this;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamDefaultControllerErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultControllerErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultControllerErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultControllerErrorCodeLength = 372; -static const JSC::Intrinsic s_writableStreamDefaultControllerErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultControllerErrorCode = - "(function (e)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (@getByIdDirectPrivate(this, \"abortSteps\") === @undefined)\n" \ - " throw @makeThisTypeError(\"WritableStreamDefaultController\", \"error\");\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(this, \"stream\");\n" \ - " if (@getByIdDirectPrivate(stream, \"state\") !== \"writable\")\n" \ - " return;\n" \ - " @writableStreamDefaultControllerError(this, e);\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().writableStreamDefaultControllerBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().writableStreamDefaultControllerBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/WritableStreamDefaultControllerBuiltins.h b/src/bun.js/builtins/cpp/WritableStreamDefaultControllerBuiltins.h deleted file mode 100644 index ca7d33d66..000000000 --- a/src/bun.js/builtins/cpp/WritableStreamDefaultControllerBuiltins.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* WritableStreamDefaultController */ -extern const char* const s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCode; -extern const int s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeImplementationVisibility; -extern const char* const s_writableStreamDefaultControllerErrorCode; -extern const int s_writableStreamDefaultControllerErrorCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultControllerErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultControllerErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultControllerErrorCodeImplementationVisibility; - -#define WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_DATA(macro) \ - macro(initializeWritableStreamDefaultController, writableStreamDefaultControllerInitializeWritableStreamDefaultController, 0) \ - macro(error, writableStreamDefaultControllerError, 1) \ - -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTCONTROLLER_INITIALIZEWRITABLESTREAMDEFAULTCONTROLLER 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTCONTROLLER_ERROR 1 - -#define WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(macro) \ - macro(writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCode, initializeWritableStreamDefaultController, ASCIILiteral(), s_writableStreamDefaultControllerInitializeWritableStreamDefaultControllerCodeLength) \ - macro(writableStreamDefaultControllerErrorCode, error, ASCIILiteral(), s_writableStreamDefaultControllerErrorCodeLength) \ - -#define WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(macro) \ - macro(error) \ - macro(initializeWritableStreamDefaultController) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class WritableStreamDefaultControllerBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit WritableStreamDefaultControllerBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* WritableStreamDefaultControllerBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void WritableStreamDefaultControllerBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTCONTROLLER_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/WritableStreamDefaultWriterBuiltins.cpp b/src/bun.js/builtins/cpp/WritableStreamDefaultWriterBuiltins.cpp deleted file mode 100644 index fc00693ca..000000000 --- a/src/bun.js/builtins/cpp/WritableStreamDefaultWriterBuiltins.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "WritableStreamDefaultWriterBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeLength = 376; -static const JSC::Intrinsic s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " //\n" \ - " //\n" \ - " const internalStream = @getInternalWritableStream(stream);\n" \ - " if (internalStream)\n" \ - " stream = internalStream;\n" \ - "\n" \ - " if (!@isWritableStream(stream))\n" \ - " @throwTypeError(\"WritableStreamDefaultWriter constructor takes a WritableStream\");\n" \ - "\n" \ - " @setUpWritableStreamDefaultWriter(this, stream);\n" \ - " return this;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamDefaultWriterClosedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultWriterClosedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultWriterClosedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultWriterClosedCodeLength = 247; -static const JSC::Intrinsic s_writableStreamDefaultWriterClosedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultWriterClosedCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isWritableStreamDefaultWriter(this))\n" \ - " return @Promise.@reject(@makeGetterTypeError(\"WritableStreamDefaultWriter\", \"closed\"));\n" \ - "\n" \ - " return @getByIdDirectPrivate(this, \"closedPromise\").@promise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamDefaultWriterDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultWriterDesiredSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultWriterDesiredSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultWriterDesiredSizeCodeLength = 359; -static const JSC::Intrinsic s_writableStreamDefaultWriterDesiredSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultWriterDesiredSizeCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isWritableStreamDefaultWriter(this))\n" \ - " throw @makeThisTypeError(\"WritableStreamDefaultWriter\", \"desiredSize\");\n" \ - "\n" \ - " if (@getByIdDirectPrivate(this, \"stream\") === @undefined)\n" \ - " @throwTypeError(\"WritableStreamDefaultWriter has no stream\");\n" \ - "\n" \ - " return @writableStreamDefaultWriterGetDesiredSize(this);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamDefaultWriterReadyCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultWriterReadyCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultWriterReadyCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultWriterReadyCodeLength = 243; -static const JSC::Intrinsic s_writableStreamDefaultWriterReadyCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultWriterReadyCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isWritableStreamDefaultWriter(this))\n" \ - " return @Promise.@reject(@makeThisTypeError(\"WritableStreamDefaultWriter\", \"ready\"));\n" \ - "\n" \ - " return @getByIdDirectPrivate(this, \"readyPromise\").@promise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamDefaultWriterAbortCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultWriterAbortCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultWriterAbortCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultWriterAbortCodeLength = 401; -static const JSC::Intrinsic s_writableStreamDefaultWriterAbortCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultWriterAbortCode = - "(function (reason)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isWritableStreamDefaultWriter(this))\n" \ - " return @Promise.@reject(@makeThisTypeError(\"WritableStreamDefaultWriter\", \"abort\"));\n" \ - "\n" \ - " if (@getByIdDirectPrivate(this, \"stream\") === @undefined)\n" \ - " return @Promise.@reject(@makeTypeError(\"WritableStreamDefaultWriter has no stream\"));\n" \ - "\n" \ - " return @writableStreamDefaultWriterAbort(this, reason);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamDefaultWriterCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultWriterCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultWriterCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultWriterCloseCodeLength = 569; -static const JSC::Intrinsic s_writableStreamDefaultWriterCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultWriterCloseCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isWritableStreamDefaultWriter(this))\n" \ - " return @Promise.@reject(@makeThisTypeError(\"WritableStreamDefaultWriter\", \"close\"));\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(this, \"stream\");\n" \ - " if (stream === @undefined)\n" \ - " return @Promise.@reject(@makeTypeError(\"WritableStreamDefaultWriter has no stream\"));\n" \ - "\n" \ - " if (@writableStreamCloseQueuedOrInFlight(stream))\n" \ - " return @Promise.@reject(@makeTypeError(\"WritableStreamDefaultWriter is being closed\"));\n" \ - " \n" \ - " return @writableStreamDefaultWriterClose(this);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamDefaultWriterReleaseLockCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultWriterReleaseLockCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultWriterReleaseLockCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultWriterReleaseLockCodeLength = 387; -static const JSC::Intrinsic s_writableStreamDefaultWriterReleaseLockCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultWriterReleaseLockCode = - "(function ()\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isWritableStreamDefaultWriter(this))\n" \ - " throw @makeThisTypeError(\"WritableStreamDefaultWriter\", \"releaseLock\");\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(this, \"stream\");\n" \ - " if (stream === @undefined)\n" \ - " return;\n" \ - "\n" \ - " @assert(@getByIdDirectPrivate(stream, \"writer\") !== @undefined);\n" \ - " @writableStreamDefaultWriterRelease(this);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamDefaultWriterWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamDefaultWriterWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamDefaultWriterWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamDefaultWriterWriteCodeLength = 399; -static const JSC::Intrinsic s_writableStreamDefaultWriterWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamDefaultWriterWriteCode = - "(function (chunk)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (!@isWritableStreamDefaultWriter(this))\n" \ - " return @Promise.@reject(@makeThisTypeError(\"WritableStreamDefaultWriter\", \"write\"));\n" \ - "\n" \ - " if (@getByIdDirectPrivate(this, \"stream\") === @undefined)\n" \ - " return @Promise.@reject(@makeTypeError(\"WritableStreamDefaultWriter has no stream\"));\n" \ - "\n" \ - " return @writableStreamDefaultWriterWrite(this, chunk);\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().writableStreamDefaultWriterBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().writableStreamDefaultWriterBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/WritableStreamDefaultWriterBuiltins.h b/src/bun.js/builtins/cpp/WritableStreamDefaultWriterBuiltins.h deleted file mode 100644 index fe0a6ef34..000000000 --- a/src/bun.js/builtins/cpp/WritableStreamDefaultWriterBuiltins.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* WritableStreamDefaultWriter */ -extern const char* const s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCode; -extern const int s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeImplementationVisibility; -extern const char* const s_writableStreamDefaultWriterClosedCode; -extern const int s_writableStreamDefaultWriterClosedCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultWriterClosedCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultWriterClosedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultWriterClosedCodeImplementationVisibility; -extern const char* const s_writableStreamDefaultWriterDesiredSizeCode; -extern const int s_writableStreamDefaultWriterDesiredSizeCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultWriterDesiredSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultWriterDesiredSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultWriterDesiredSizeCodeImplementationVisibility; -extern const char* const s_writableStreamDefaultWriterReadyCode; -extern const int s_writableStreamDefaultWriterReadyCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultWriterReadyCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultWriterReadyCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultWriterReadyCodeImplementationVisibility; -extern const char* const s_writableStreamDefaultWriterAbortCode; -extern const int s_writableStreamDefaultWriterAbortCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultWriterAbortCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultWriterAbortCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultWriterAbortCodeImplementationVisibility; -extern const char* const s_writableStreamDefaultWriterCloseCode; -extern const int s_writableStreamDefaultWriterCloseCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultWriterCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultWriterCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultWriterCloseCodeImplementationVisibility; -extern const char* const s_writableStreamDefaultWriterReleaseLockCode; -extern const int s_writableStreamDefaultWriterReleaseLockCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultWriterReleaseLockCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultWriterReleaseLockCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultWriterReleaseLockCodeImplementationVisibility; -extern const char* const s_writableStreamDefaultWriterWriteCode; -extern const int s_writableStreamDefaultWriterWriteCodeLength; -extern const JSC::ConstructAbility s_writableStreamDefaultWriterWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamDefaultWriterWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamDefaultWriterWriteCodeImplementationVisibility; - -#define WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_DATA(macro) \ - macro(initializeWritableStreamDefaultWriter, writableStreamDefaultWriterInitializeWritableStreamDefaultWriter, 1) \ - macro(closed, writableStreamDefaultWriterClosed, 0) \ - macro(desiredSize, writableStreamDefaultWriterDesiredSize, 0) \ - macro(ready, writableStreamDefaultWriterReady, 0) \ - macro(abort, writableStreamDefaultWriterAbort, 1) \ - macro(close, writableStreamDefaultWriterClose, 0) \ - macro(releaseLock, writableStreamDefaultWriterReleaseLock, 0) \ - macro(write, writableStreamDefaultWriterWrite, 1) \ - -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTWRITER_INITIALIZEWRITABLESTREAMDEFAULTWRITER 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTWRITER_CLOSED 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTWRITER_DESIREDSIZE 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTWRITER_READY 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTWRITER_ABORT 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTWRITER_CLOSE 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTWRITER_RELEASELOCK 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMDEFAULTWRITER_WRITE 1 - -#define WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_CODE(macro) \ - macro(writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCode, initializeWritableStreamDefaultWriter, ASCIILiteral(), s_writableStreamDefaultWriterInitializeWritableStreamDefaultWriterCodeLength) \ - macro(writableStreamDefaultWriterClosedCode, closed, "get closed"_s, s_writableStreamDefaultWriterClosedCodeLength) \ - macro(writableStreamDefaultWriterDesiredSizeCode, desiredSize, "get desiredSize"_s, s_writableStreamDefaultWriterDesiredSizeCodeLength) \ - macro(writableStreamDefaultWriterReadyCode, ready, "get ready"_s, s_writableStreamDefaultWriterReadyCodeLength) \ - macro(writableStreamDefaultWriterAbortCode, abort, ASCIILiteral(), s_writableStreamDefaultWriterAbortCodeLength) \ - macro(writableStreamDefaultWriterCloseCode, close, ASCIILiteral(), s_writableStreamDefaultWriterCloseCodeLength) \ - macro(writableStreamDefaultWriterReleaseLockCode, releaseLock, ASCIILiteral(), s_writableStreamDefaultWriterReleaseLockCodeLength) \ - macro(writableStreamDefaultWriterWriteCode, write, ASCIILiteral(), s_writableStreamDefaultWriterWriteCodeLength) \ - -#define WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_FUNCTION_NAME(macro) \ - macro(abort) \ - macro(close) \ - macro(closed) \ - macro(desiredSize) \ - macro(initializeWritableStreamDefaultWriter) \ - macro(ready) \ - macro(releaseLock) \ - macro(write) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class WritableStreamDefaultWriterBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit WritableStreamDefaultWriterBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* WritableStreamDefaultWriterBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void WritableStreamDefaultWriterBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_WRITABLESTREAMDEFAULTWRITER_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/WritableStreamInternalsBuiltins.cpp b/src/bun.js/builtins/cpp/WritableStreamInternalsBuiltins.cpp deleted file mode 100644 index 6b2111f4b..000000000 --- a/src/bun.js/builtins/cpp/WritableStreamInternalsBuiltins.cpp +++ /dev/null @@ -1,1232 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "WritableStreamInternalsBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSObjectInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - -const JSC::ConstructAbility s_writableStreamInternalsIsWritableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsIsWritableStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsIsWritableStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsIsWritableStreamCodeLength = 126; -static const JSC::Intrinsic s_writableStreamInternalsIsWritableStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsIsWritableStreamCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " return @isObject(stream) && !!@getByIdDirectPrivate(stream, \"underlyingSink\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsIsWritableStreamDefaultWriterCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsIsWritableStreamDefaultWriterCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsIsWritableStreamDefaultWriterCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsIsWritableStreamDefaultWriterCodeLength = 125; -static const JSC::Intrinsic s_writableStreamInternalsIsWritableStreamDefaultWriterCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsIsWritableStreamDefaultWriterCode = - "(function (writer)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " return @isObject(writer) && !!@getByIdDirectPrivate(writer, \"closedPromise\");\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeLength = 77; -static const JSC::Intrinsic s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsAcquireWritableStreamDefaultWriterCode = - "(function (stream)\n" \ - "{\n" \ - " return new @WritableStreamDefaultWriter(stream);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsCreateWritableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsCreateWritableStreamCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsCreateWritableStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsCreateWritableStreamCodeLength = 588; -static const JSC::Intrinsic s_writableStreamInternalsCreateWritableStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsCreateWritableStreamCode = - "(function (startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm)\n" \ - "{\n" \ - " @assert(typeof highWaterMark === \"number\" && !@isNaN(highWaterMark) && highWaterMark >= 0);\n" \ - "\n" \ - " const internalStream = { };\n" \ - " @initializeWritableStreamSlots(internalStream, { });\n" \ - " const controller = new @WritableStreamDefaultController();\n" \ - "\n" \ - " @setUpWritableStreamDefaultController(internalStream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm);\n" \ - "\n" \ - " return @createWritableStreamFromInternal(internalStream);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeLength = 1776; -static const JSC::Intrinsic s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCode = - "(function (underlyingSink, strategy)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const stream = { };\n" \ - "\n" \ - " if (underlyingSink === @undefined)\n" \ - " underlyingSink = { };\n" \ - "\n" \ - " if (strategy === @undefined)\n" \ - " strategy = { };\n" \ - "\n" \ - " if (!@isObject(underlyingSink))\n" \ - " @throwTypeError(\"WritableStream constructor takes an object as first argument\");\n" \ - "\n" \ - " if (\"type\" in underlyingSink)\n" \ - " @throwRangeError(\"Invalid type is specified\");\n" \ - "\n" \ - " const sizeAlgorithm = @extractSizeAlgorithm(strategy);\n" \ - " const highWaterMark = @extractHighWaterMark(strategy, 1);\n" \ - "\n" \ - " const underlyingSinkDict = { };\n" \ - " if (\"start\" in underlyingSink) {\n" \ - " underlyingSinkDict[\"start\"] = underlyingSink[\"start\"];\n" \ - " if (typeof underlyingSinkDict[\"start\"] !== \"function\")\n" \ - " @throwTypeError(\"underlyingSink.start should be a function\");\n" \ - " }\n" \ - " if (\"write\" in underlyingSink) {\n" \ - " underlyingSinkDict[\"write\"] = underlyingSink[\"write\"];\n" \ - " if (typeof underlyingSinkDict[\"write\"] !== \"function\")\n" \ - " @throwTypeError(\"underlyingSink.write should be a function\");\n" \ - " }\n" \ - " if (\"close\" in underlyingSink) {\n" \ - " underlyingSinkDict[\"close\"] = underlyingSink[\"close\"];\n" \ - " if (typeof underlyingSinkDict[\"close\"] !== \"function\")\n" \ - " @throwTypeError(\"underlyingSink.close should be a function\");\n" \ - " }\n" \ - " if (\"abort\" in underlyingSink) {\n" \ - " underlyingSinkDict[\"abort\"] = underlyingSink[\"abort\"];\n" \ - " if (typeof underlyingSinkDict[\"abort\"] !== \"function\")\n" \ - " @throwTypeError(\"underlyingSink.abort should be a function\");\n" \ - " }\n" \ - "\n" \ - " @initializeWritableStreamSlots(stream, underlyingSink);\n" \ - " @setUpWritableStreamDefaultControllerFromUnderlyingSink(stream, underlyingSink, underlyingSinkDict, highWaterMark, sizeAlgorithm);\n" \ - "\n" \ - " return stream;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsInitializeWritableStreamSlotsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsInitializeWritableStreamSlotsCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsInitializeWritableStreamSlotsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsInitializeWritableStreamSlotsCodeLength = 762; -static const JSC::Intrinsic s_writableStreamInternalsInitializeWritableStreamSlotsCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsInitializeWritableStreamSlotsCode = - "(function (stream, underlyingSink)\n" \ - "{ \"use strict\";\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"state\", \"writable\");\n" \ - " @putByIdDirectPrivate(stream, \"storedError\", @undefined);\n" \ - " @putByIdDirectPrivate(stream, \"writer\", @undefined);\n" \ - " @putByIdDirectPrivate(stream, \"controller\", @undefined);\n" \ - " @putByIdDirectPrivate(stream, \"inFlightWriteRequest\", @undefined);\n" \ - " @putByIdDirectPrivate(stream, \"closeRequest\", @undefined);\n" \ - " @putByIdDirectPrivate(stream, \"inFlightCloseRequest\", @undefined);\n" \ - " @putByIdDirectPrivate(stream, \"pendingAbortRequest\", @undefined);\n" \ - " @putByIdDirectPrivate(stream, \"writeRequests\", @createFIFO());\n" \ - " @putByIdDirectPrivate(stream, \"backpressure\", false);\n" \ - " @putByIdDirectPrivate(stream, \"underlyingSink\", underlyingSink);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamCloseForBindingsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamCloseForBindingsCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamCloseForBindingsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamCloseForBindingsCodeLength = 434; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamCloseForBindingsCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamCloseForBindingsCode = - "(function (stream)\n" \ - "{ \"use strict\";\n" \ - "\n" \ - " if (@isWritableStreamLocked(stream))\n" \ - " return @Promise.@reject(@makeTypeError(\"WritableStream.close method can only be used on non locked WritableStream\"));\n" \ - "\n" \ - " if (@writableStreamCloseQueuedOrInFlight(stream))\n" \ - " return @Promise.@reject(@makeTypeError(\"WritableStream.close method can only be used on a being close WritableStream\"));\n" \ - "\n" \ - " return @writableStreamClose(stream);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamAbortForBindingsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamAbortForBindingsCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamAbortForBindingsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamAbortForBindingsCodeLength = 266; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamAbortForBindingsCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamAbortForBindingsCode = - "(function (stream, reason)\n" \ - "{ \"use strict\";\n" \ - "\n" \ - " if (@isWritableStreamLocked(stream))\n" \ - " return @Promise.@reject(@makeTypeError(\"WritableStream.abort method can only be used on non locked WritableStream\"));\n" \ - "\n" \ - " return @writableStreamAbort(stream, reason);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsIsWritableStreamLockedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsIsWritableStreamLockedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsIsWritableStreamLockedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsIsWritableStreamLockedCodeLength = 108; -static const JSC::Intrinsic s_writableStreamInternalsIsWritableStreamLockedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsIsWritableStreamLockedCode = - "(function (stream)\n" \ - "{ \"use strict\";\n" \ - "\n" \ - " return @getByIdDirectPrivate(stream, \"writer\") !== @undefined;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeLength = 1538; -static const JSC::Intrinsic s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsSetUpWritableStreamDefaultWriterCode = - "(function (writer, stream)\n" \ - "{ \"use strict\";\n" \ - "\n" \ - " if (@isWritableStreamLocked(stream))\n" \ - " @throwTypeError(\"WritableStream is locked\");\n" \ - "\n" \ - " @putByIdDirectPrivate(writer, \"stream\", stream);\n" \ - " @putByIdDirectPrivate(stream, \"writer\", writer);\n" \ - "\n" \ - " const readyPromiseCapability = @newPromiseCapability(@Promise);\n" \ - " const closedPromiseCapability = @newPromiseCapability(@Promise);\n" \ - " @putByIdDirectPrivate(writer, \"readyPromise\", readyPromiseCapability);\n" \ - " @putByIdDirectPrivate(writer, \"closedPromise\", closedPromiseCapability);\n" \ - "\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - " if (state === \"writable\") {\n" \ - " if (@writableStreamCloseQueuedOrInFlight(stream) || !@getByIdDirectPrivate(stream, \"backpressure\"))\n" \ - " readyPromiseCapability.@resolve.@call();\n" \ - " } else if (state === \"erroring\") {\n" \ - " readyPromiseCapability.@reject.@call(@undefined, @getByIdDirectPrivate(stream, \"storedError\"));\n" \ - " @markPromiseAsHandled(readyPromiseCapability.@promise);\n" \ - " } else if (state === \"closed\") {\n" \ - " readyPromiseCapability.@resolve.@call();\n" \ - " closedPromiseCapability.@resolve.@call();\n" \ - " } else {\n" \ - " @assert(state === \"errored\");\n" \ - " const storedError = @getByIdDirectPrivate(stream, \"storedError\");\n" \ - " readyPromiseCapability.@reject.@call(@undefined, storedError);\n" \ - " @markPromiseAsHandled(readyPromiseCapability.@promise);\n" \ - " closedPromiseCapability.@reject.@call(@undefined, storedError);\n" \ - " @markPromiseAsHandled(closedPromiseCapability.@promise);\n" \ - " }\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamAbortCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamAbortCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamAbortCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamAbortCodeLength = 928; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamAbortCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamAbortCode = - "(function (stream, reason)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - " if (state === \"closed\" || state === \"errored\")\n" \ - " return @Promise.@resolve();\n" \ - "\n" \ - " const pendingAbortRequest = @getByIdDirectPrivate(stream, \"pendingAbortRequest\");\n" \ - " if (pendingAbortRequest !== @undefined)\n" \ - " return pendingAbortRequest.promise.@promise;\n" \ - "\n" \ - " @assert(state === \"writable\" || state === \"erroring\");\n" \ - " let wasAlreadyErroring = false;\n" \ - " if (state === \"erroring\") {\n" \ - " wasAlreadyErroring = true;\n" \ - " reason = @undefined;\n" \ - " }\n" \ - "\n" \ - " const abortPromiseCapability = @newPromiseCapability(@Promise);\n" \ - " @putByIdDirectPrivate(stream, \"pendingAbortRequest\", { promise : abortPromiseCapability, reason : reason, wasAlreadyErroring : wasAlreadyErroring });\n" \ - "\n" \ - " if (!wasAlreadyErroring)\n" \ - " @writableStreamStartErroring(stream, reason);\n" \ - " return abortPromiseCapability.@promise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamCloseCodeLength = 904; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamCloseCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - " if (state === \"closed\" || state === \"errored\")\n" \ - " return @Promise.@reject(@makeTypeError(\"Cannot close a writable stream that is closed or errored\"));\n" \ - "\n" \ - " @assert(state === \"writable\" || state === \"erroring\");\n" \ - " @assert(!@writableStreamCloseQueuedOrInFlight(stream));\n" \ - "\n" \ - " const closePromiseCapability = @newPromiseCapability(@Promise);\n" \ - " @putByIdDirectPrivate(stream, \"closeRequest\", closePromiseCapability);\n" \ - "\n" \ - " const writer = @getByIdDirectPrivate(stream, \"writer\");\n" \ - " if (writer !== @undefined && @getByIdDirectPrivate(stream, \"backpressure\") && state === \"writable\")\n" \ - " @getByIdDirectPrivate(writer, \"readyPromise\").@resolve.@call();\n" \ - " \n" \ - " @writableStreamDefaultControllerClose(@getByIdDirectPrivate(stream, \"controller\"));\n" \ - "\n" \ - " return closePromiseCapability.@promise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamAddWriteRequestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamAddWriteRequestCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamAddWriteRequestCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamAddWriteRequestCodeLength = 391; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamAddWriteRequestCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamAddWriteRequestCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@isWritableStreamLocked(stream))\n" \ - " @assert(@getByIdDirectPrivate(stream, \"state\") === \"writable\");\n" \ - "\n" \ - " const writePromiseCapability = @newPromiseCapability(@Promise);\n" \ - " const writeRequests = @getByIdDirectPrivate(stream, \"writeRequests\");\n" \ - " writeRequests.push(writePromiseCapability);\n" \ - " return writePromiseCapability.@promise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeLength = 188; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " return @getByIdDirectPrivate(stream, \"closeRequest\") !== @undefined || @getByIdDirectPrivate(stream, \"inFlightCloseRequest\") !== @undefined;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDealWithRejectionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDealWithRejectionCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDealWithRejectionCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDealWithRejectionCodeLength = 294; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDealWithRejectionCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDealWithRejectionCode = - "(function (stream, error)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - " if (state === \"writable\") {\n" \ - " @writableStreamStartErroring(stream, error);\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " @assert(state === \"erroring\");\n" \ - " @writableStreamFinishErroring(stream);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishErroringCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishErroringCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishErroringCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamFinishErroringCodeLength = 1575; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishErroringCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamFinishErroringCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@getByIdDirectPrivate(stream, \"state\") === \"erroring\");\n" \ - " @assert(!@writableStreamHasOperationMarkedInFlight(stream));\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"state\", \"errored\");\n" \ - "\n" \ - " const controller = @getByIdDirectPrivate(stream, \"controller\");\n" \ - " @getByIdDirectPrivate(controller, \"errorSteps\").@call();\n" \ - "\n" \ - " const storedError = @getByIdDirectPrivate(stream, \"storedError\");\n" \ - " const requests = @getByIdDirectPrivate(stream, \"writeRequests\");\n" \ - " for (var request = requests.shift(); request; request = requests.shift())\n" \ - " request.@reject.@call(@undefined, storedError);\n" \ - "\n" \ - " //\n" \ - " @putByIdDirectPrivate(stream, \"writeRequests\", @createFIFO());\n" \ - "\n" \ - " const abortRequest = @getByIdDirectPrivate(stream, \"pendingAbortRequest\");\n" \ - " if (abortRequest === @undefined) {\n" \ - " @writableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"pendingAbortRequest\", @undefined);\n" \ - " if (abortRequest.wasAlreadyErroring) {\n" \ - " abortRequest.promise.@reject.@call(@undefined, storedError);\n" \ - " @writableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " @getByIdDirectPrivate(controller, \"abortSteps\").@call(@undefined, abortRequest.reason).@then(() => {\n" \ - " abortRequest.promise.@resolve.@call();\n" \ - " @writableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n" \ - " }, (reason) => {\n" \ - " abortRequest.promise.@reject.@call(@undefined, reason);\n" \ - " @writableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n" \ - " });\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeLength = 1111; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamFinishInFlightCloseCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const inFlightCloseRequest = @getByIdDirectPrivate(stream, \"inFlightCloseRequest\");\n" \ - " inFlightCloseRequest.@resolve.@call();\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"inFlightCloseRequest\", @undefined);\n" \ - "\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - " @assert(state === \"writable\" || state === \"erroring\");\n" \ - "\n" \ - " if (state === \"erroring\") {\n" \ - " @putByIdDirectPrivate(stream, \"storedError\", @undefined);\n" \ - " const abortRequest = @getByIdDirectPrivate(stream, \"pendingAbortRequest\");\n" \ - " if (abortRequest !== @undefined) {\n" \ - " abortRequest.promise.@resolve.@call();\n" \ - " @putByIdDirectPrivate(stream, \"pendingAbortRequest\", @undefined);\n" \ - " }\n" \ - " }\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"state\", \"closed\");\n" \ - "\n" \ - " const writer = @getByIdDirectPrivate(stream, \"writer\");\n" \ - " if (writer !== @undefined)\n" \ - " @getByIdDirectPrivate(writer, \"closedPromise\").@resolve.@call();\n" \ - "\n" \ - " @assert(@getByIdDirectPrivate(stream, \"pendingAbortRequest\") === @undefined);\n" \ - " @assert(@getByIdDirectPrivate(stream, \"storedError\") === @undefined);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeLength = 753; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCode = - "(function (stream, error)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const inFlightCloseRequest = @getByIdDirectPrivate(stream, \"inFlightCloseRequest\");\n" \ - " @assert(inFlightCloseRequest !== @undefined);\n" \ - " inFlightCloseRequest.@reject.@call(@undefined, error);\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"inFlightCloseRequest\", @undefined);\n" \ - "\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - " @assert(state === \"writable\" || state === \"erroring\");\n" \ - "\n" \ - " const abortRequest = @getByIdDirectPrivate(stream, \"pendingAbortRequest\");\n" \ - " if (abortRequest !== @undefined) {\n" \ - " abortRequest.promise.@reject.@call(@undefined, error);\n" \ - " @putByIdDirectPrivate(stream, \"pendingAbortRequest\", @undefined);\n" \ - " }\n" \ - "\n" \ - " @writableStreamDealWithRejection(stream, error);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeLength = 296; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamFinishInFlightWriteCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const inFlightWriteRequest = @getByIdDirectPrivate(stream, \"inFlightWriteRequest\");\n" \ - " @assert(inFlightWriteRequest !== @undefined);\n" \ - " inFlightWriteRequest.@resolve.@call();\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"inFlightWriteRequest\", @undefined);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeLength = 491; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCode = - "(function (stream, error)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const inFlightWriteRequest = @getByIdDirectPrivate(stream, \"inFlightWriteRequest\");\n" \ - " @assert(inFlightWriteRequest !== @undefined);\n" \ - " inFlightWriteRequest.@reject.@call(@undefined, error);\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"inFlightWriteRequest\", @undefined);\n" \ - "\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - " @assert(state === \"writable\" || state === \"erroring\");\n" \ - "\n" \ - " @writableStreamDealWithRejection(stream, error);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeLength = 196; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " return @getByIdDirectPrivate(stream, \"inFlightWriteRequest\") !== @undefined || @getByIdDirectPrivate(stream, \"inFlightCloseRequest\") !== @undefined;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeLength = 377; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const closeRequest = @getByIdDirectPrivate(stream, \"closeRequest\");\n" \ - " @assert(@getByIdDirectPrivate(stream, \"inFlightCloseRequest\") === @undefined);\n" \ - " @assert(closeRequest !== @undefined);\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"inFlightCloseRequest\", closeRequest);\n" \ - " @putByIdDirectPrivate(stream, \"closeRequest\", @undefined);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeLength = 363; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const writeRequests = @getByIdDirectPrivate(stream, \"writeRequests\");\n" \ - " @assert(@getByIdDirectPrivate(stream, \"inFlightWriteRequest\") === @undefined);\n" \ - " @assert(writeRequests.isNotEmpty());\n" \ - "\n" \ - " const writeRequest = writeRequests.shift();\n" \ - " @putByIdDirectPrivate(stream, \"inFlightWriteRequest\", writeRequest);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeLength = 809; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCode = - "(function (stream)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@getByIdDirectPrivate(stream, \"state\") === \"errored\");\n" \ - "\n" \ - " const storedError = @getByIdDirectPrivate(stream, \"storedError\");\n" \ - "\n" \ - " const closeRequest = @getByIdDirectPrivate(stream, \"closeRequest\");\n" \ - " if (closeRequest !== @undefined) {\n" \ - " @assert(@getByIdDirectPrivate(stream, \"inFlightCloseRequest\") === @undefined);\n" \ - " closeRequest.@reject.@call(@undefined, storedError);\n" \ - " @putByIdDirectPrivate(stream, \"closeRequest\", @undefined);\n" \ - " }\n" \ - "\n" \ - " const writer = @getByIdDirectPrivate(stream, \"writer\");\n" \ - " if (writer !== @undefined) {\n" \ - " const closedPromise = @getByIdDirectPrivate(writer, \"closedPromise\");\n" \ - " closedPromise.@reject.@call(@undefined, storedError);\n" \ - " @markPromiseAsHandled(closedPromise.@promise);\n" \ - " }\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamStartErroringCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamStartErroringCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamStartErroringCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamStartErroringCodeLength = 752; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamStartErroringCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamStartErroringCode = - "(function (stream, reason)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@getByIdDirectPrivate(stream, \"storedError\") === @undefined);\n" \ - " @assert(@getByIdDirectPrivate(stream, \"state\") === \"writable\");\n" \ - " \n" \ - " const controller = @getByIdDirectPrivate(stream, \"controller\");\n" \ - " @assert(controller !== @undefined);\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"state\", \"erroring\");\n" \ - " @putByIdDirectPrivate(stream, \"storedError\", reason);\n" \ - "\n" \ - " const writer = @getByIdDirectPrivate(stream, \"writer\");\n" \ - " if (writer !== @undefined)\n" \ - " @writableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason);\n" \ - "\n" \ - " if (!@writableStreamHasOperationMarkedInFlight(stream) && @getByIdDirectPrivate(controller, \"started\") === 1)\n" \ - " @writableStreamFinishErroring(stream);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamUpdateBackpressureCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamUpdateBackpressureCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamUpdateBackpressureCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamUpdateBackpressureCodeLength = 621; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamUpdateBackpressureCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamUpdateBackpressureCode = - "(function (stream, backpressure)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " @assert(@getByIdDirectPrivate(stream, \"state\") === \"writable\");\n" \ - " @assert(!@writableStreamCloseQueuedOrInFlight(stream));\n" \ - "\n" \ - " const writer = @getByIdDirectPrivate(stream, \"writer\");\n" \ - " if (writer !== @undefined && backpressure !== @getByIdDirectPrivate(stream, \"backpressure\")) {\n" \ - " if (backpressure)\n" \ - " @putByIdDirectPrivate(writer, \"readyPromise\", @newPromiseCapability(@Promise));\n" \ - " else\n" \ - " @getByIdDirectPrivate(writer, \"readyPromise\").@resolve.@call();\n" \ - " }\n" \ - " @putByIdDirectPrivate(stream, \"backpressure\", backpressure);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeLength = 195; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultWriterAbortCode = - "(function (writer, reason)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " const stream = @getByIdDirectPrivate(writer, \"stream\");\n" \ - " @assert(stream !== @undefined);\n" \ - " return @writableStreamAbort(stream, reason);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeLength = 179; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultWriterCloseCode = - "(function (writer)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " const stream = @getByIdDirectPrivate(writer, \"stream\");\n" \ - " @assert(stream !== @undefined);\n" \ - " return @writableStreamClose(stream);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeLength = 533; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCode = - "(function (writer)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " const stream = @getByIdDirectPrivate(writer, \"stream\");\n" \ - " @assert(stream !== @undefined);\n" \ - "\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - "\n" \ - " if (@writableStreamCloseQueuedOrInFlight(stream) || state === \"closed\")\n" \ - " return @Promise.@resolve();\n" \ - "\n" \ - " if (state === \"errored\")\n" \ - " return @Promise.@reject(@getByIdDirectPrivate(stream, \"storedError\"));\n" \ - "\n" \ - " @assert(state === \"writable\" || state === \"erroring\");\n" \ - " return @writableStreamDefaultWriterClose(writer);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeLength = 625; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCode = - "(function (writer, error)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " let closedPromiseCapability = @getByIdDirectPrivate(writer, \"closedPromise\");\n" \ - " let closedPromise = closedPromiseCapability.@promise;\n" \ - "\n" \ - " if ((@getPromiseInternalField(closedPromise, @promiseFieldFlags) & @promiseStateMask) !== @promiseStatePending) {\n" \ - " closedPromiseCapability = @newPromiseCapability(@Promise);\n" \ - " closedPromise = closedPromiseCapability.@promise;\n" \ - " @putByIdDirectPrivate(writer, \"closedPromise\", closedPromiseCapability);\n" \ - " }\n" \ - "\n" \ - " closedPromiseCapability.@reject.@call(@undefined, error);\n" \ - " @markPromiseAsHandled(closedPromise);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeLength = 613; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCode = - "(function (writer, error)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " let readyPromiseCapability = @getByIdDirectPrivate(writer, \"readyPromise\");\n" \ - " let readyPromise = readyPromiseCapability.@promise;\n" \ - "\n" \ - " if ((@getPromiseInternalField(readyPromise, @promiseFieldFlags) & @promiseStateMask) !== @promiseStatePending) {\n" \ - " readyPromiseCapability = @newPromiseCapability(@Promise);\n" \ - " readyPromise = readyPromiseCapability.@promise;\n" \ - " @putByIdDirectPrivate(writer, \"readyPromise\", readyPromiseCapability);\n" \ - " }\n" \ - "\n" \ - " readyPromiseCapability.@reject.@call(@undefined, error);\n" \ - " @markPromiseAsHandled(readyPromise);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeLength = 424; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCode = - "(function (writer)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " const stream = @getByIdDirectPrivate(writer, \"stream\");\n" \ - " @assert(stream !== @undefined);\n" \ - "\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - "\n" \ - " if (state === \"errored\" || state === \"erroring\")\n" \ - " return null;\n" \ - "\n" \ - " if (state === \"closed\")\n" \ - " return 0;\n" \ - "\n" \ - " return @writableStreamDefaultControllerGetDesiredSize(@getByIdDirectPrivate(stream, \"controller\"));\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeLength = 568; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultWriterReleaseCode = - "(function (writer)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(writer, \"stream\");\n" \ - " @assert(stream !== @undefined);\n" \ - " @assert(@getByIdDirectPrivate(stream, \"writer\") === writer);\n" \ - "\n" \ - " const releasedError = @makeTypeError(\"writableStreamDefaultWriterRelease\");\n" \ - "\n" \ - " @writableStreamDefaultWriterEnsureReadyPromiseRejected(writer, releasedError);\n" \ - " @writableStreamDefaultWriterEnsureClosedPromiseRejected(writer, releasedError);\n" \ - "\n" \ - " @putByIdDirectPrivate(stream, \"writer\", @undefined);\n" \ - " @putByIdDirectPrivate(writer, \"stream\", @undefined);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeLength = 1266; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultWriterWriteCode = - "(function (writer, chunk)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(writer, \"stream\");\n" \ - " @assert(stream !== @undefined);\n" \ - "\n" \ - " const controller = @getByIdDirectPrivate(stream, \"controller\");\n" \ - " @assert(controller !== @undefined);\n" \ - " const chunkSize = @writableStreamDefaultControllerGetChunkSize(controller, chunk);\n" \ - "\n" \ - " if (stream !== @getByIdDirectPrivate(writer, \"stream\"))\n" \ - " return @Promise.@reject(@makeTypeError(\"writer is not stream's writer\"));\n" \ - "\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - " if (state === \"errored\")\n" \ - " return @Promise.@reject(@getByIdDirectPrivate(stream, \"storedError\"));\n" \ - "\n" \ - " if (@writableStreamCloseQueuedOrInFlight(stream) || state === \"closed\")\n" \ - " return @Promise.@reject(@makeTypeError(\"stream is closing or closed\"));\n" \ - "\n" \ - " if (@writableStreamCloseQueuedOrInFlight(stream) || state === \"closed\")\n" \ - " return @Promise.@reject(@makeTypeError(\"stream is closing or closed\"));\n" \ - "\n" \ - " if (state === \"erroring\")\n" \ - " return @Promise.@reject(@getByIdDirectPrivate(stream, \"storedError\"));\n" \ - "\n" \ - " @assert(state === \"writable\");\n" \ - "\n" \ - " const promise = @writableStreamAddWriteRequest(stream);\n" \ - " @writableStreamDefaultControllerWrite(controller, chunk, chunkSize);\n" \ - " return promise;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeLength = 1142; -static const JSC::Intrinsic s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsSetUpWritableStreamDefaultControllerCode = - "(function (stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm)\n" \ - "{\n" \ - " \"use strict\";\n" \ - "\n" \ - " @assert(@isWritableStream(stream));\n" \ - " @assert(@getByIdDirectPrivate(stream, \"controller\") === @undefined);\n" \ - "\n" \ - " @putByIdDirectPrivate(controller, \"stream\", stream);\n" \ - " @putByIdDirectPrivate(stream, \"controller\", controller);\n" \ - "\n" \ - " @resetQueue(@getByIdDirectPrivate(controller, \"queue\"));\n" \ - "\n" \ - " @putByIdDirectPrivate(controller, \"started\", -1);\n" \ - " @putByIdDirectPrivate(controller, \"startAlgorithm\", startAlgorithm);\n" \ - " @putByIdDirectPrivate(controller, \"strategySizeAlgorithm\", sizeAlgorithm);\n" \ - " @putByIdDirectPrivate(controller, \"strategyHWM\", highWaterMark);\n" \ - " @putByIdDirectPrivate(controller, \"writeAlgorithm\", writeAlgorithm);\n" \ - " @putByIdDirectPrivate(controller, \"closeAlgorithm\", closeAlgorithm);\n" \ - " @putByIdDirectPrivate(controller, \"abortAlgorithm\", abortAlgorithm);\n" \ - "\n" \ - " const backpressure = @writableStreamDefaultControllerGetBackpressure(controller);\n" \ - " @writableStreamUpdateBackpressure(stream, backpressure);\n" \ - "\n" \ - " @writableStreamDefaultControllerStart(controller);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerStartCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerStartCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerStartCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerStartCodeLength = 982; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerStartCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerStartCode = - "(function (controller) {\n" \ - " \"use strict\";\n" \ - "\n" \ - " if (@getByIdDirectPrivate(controller, \"started\") !== -1)\n" \ - " return;\n" \ - "\n" \ - " @putByIdDirectPrivate(controller, \"started\", 0);\n" \ - "\n" \ - " const startAlgorithm = @getByIdDirectPrivate(controller, \"startAlgorithm\");\n" \ - " @putByIdDirectPrivate(controller, \"startAlgorithm\", @undefined);\n" \ - " const stream = @getByIdDirectPrivate(controller, \"stream\");\n" \ - " return @Promise.@resolve(startAlgorithm.@call()).@then(() => {\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - " @assert(state === \"writable\" || state === \"erroring\");\n" \ - " @putByIdDirectPrivate(controller, \"started\", 1);\n" \ - " @writableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n" \ - " }, (error) => {\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - " @assert(state === \"writable\" || state === \"erroring\");\n" \ - " @putByIdDirectPrivate(controller, \"started\", 1);\n" \ - " @writableStreamDealWithRejection(stream, error);\n" \ - " });\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeLength = 1394; -static const JSC::Intrinsic s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCode = - "(function (stream, underlyingSink, underlyingSinkDict, highWaterMark, sizeAlgorithm)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " const controller = new @WritableStreamDefaultController();\n" \ - "\n" \ - " let startAlgorithm = () => { };\n" \ - " let writeAlgorithm = () => { return @Promise.@resolve(); };\n" \ - " let closeAlgorithm = () => { return @Promise.@resolve(); };\n" \ - " let abortAlgorithm = () => { return @Promise.@resolve(); };\n" \ - "\n" \ - " if (\"start\" in underlyingSinkDict) {\n" \ - " const startMethod = underlyingSinkDict[\"start\"];\n" \ - " startAlgorithm = () => @promiseInvokeOrNoopMethodNoCatch(underlyingSink, startMethod, [controller]);\n" \ - " }\n" \ - " if (\"write\" in underlyingSinkDict) {\n" \ - " const writeMethod = underlyingSinkDict[\"write\"];\n" \ - " writeAlgorithm = (chunk) => @promiseInvokeOrNoopMethod(underlyingSink, writeMethod, [chunk, controller]);\n" \ - " }\n" \ - " if (\"close\" in underlyingSinkDict) {\n" \ - " const closeMethod = underlyingSinkDict[\"close\"];\n" \ - " closeAlgorithm = () => @promiseInvokeOrNoopMethod(underlyingSink, closeMethod, []);\n" \ - " }\n" \ - " if (\"abort\" in underlyingSinkDict) {\n" \ - " const abortMethod = underlyingSinkDict[\"abort\"];\n" \ - " abortAlgorithm = (reason) => @promiseInvokeOrNoopMethod(underlyingSink, abortMethod, [reason]);\n" \ - " }\n" \ - "\n" \ - " @setUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeLength = 884; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCode = - "(function (controller)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " const stream = @getByIdDirectPrivate(controller, \"stream\");\n" \ - "\n" \ - " if (@getByIdDirectPrivate(controller, \"started\") !== 1)\n" \ - " return;\n" \ - "\n" \ - " @assert(stream !== @undefined);\n" \ - " if (@getByIdDirectPrivate(stream, \"inFlightWriteRequest\") !== @undefined)\n" \ - " return;\n" \ - "\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - " @assert(state !== \"closed\" || state !== \"errored\");\n" \ - " if (state === \"erroring\") {\n" \ - " @writableStreamFinishErroring(stream);\n" \ - " return;\n" \ - " }\n" \ - "\n" \ - " const queue = @getByIdDirectPrivate(controller, \"queue\");\n" \ - "\n" \ - " if (queue.content?.isEmpty() ?? false)\n" \ - " return;\n" \ - "\n" \ - " const value = @peekQueueValue(queue);\n" \ - " if (value === @isCloseSentinel)\n" \ - " @writableStreamDefaultControllerProcessClose(controller);\n" \ - " else\n" \ - " @writableStreamDefaultControllerProcessWrite(controller, value);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsIsCloseSentinelCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsIsCloseSentinelCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsIsCloseSentinelCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsIsCloseSentinelCodeLength = 18; -static const JSC::Intrinsic s_writableStreamInternalsIsCloseSentinelCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsIsCloseSentinelCode = - "(function ()\n" \ - "{\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeLength = 329; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCode = - "(function (controller)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " @putByIdDirectPrivate(controller, \"writeAlgorithm\", @undefined);\n" \ - " @putByIdDirectPrivate(controller, \"closeAlgorithm\", @undefined);\n" \ - " @putByIdDirectPrivate(controller, \"abortAlgorithm\", @undefined);\n" \ - " @putByIdDirectPrivate(controller, \"strategySizeAlgorithm\", @undefined);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeLength = 208; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerCloseCode = - "(function (controller)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " @enqueueValueWithSize(@getByIdDirectPrivate(controller, \"queue\"), @isCloseSentinel, 0);\n" \ - " @writableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeLength = 336; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerErrorCode = - "(function (controller, error)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " const stream = @getByIdDirectPrivate(controller, \"stream\");\n" \ - " @assert(stream !== @undefined);\n" \ - " @assert(@getByIdDirectPrivate(stream, \"state\") === \"writable\");\n" \ - "\n" \ - " @writableStreamDefaultControllerClearAlgorithms(controller);\n" \ - " @writableStreamStartErroring(stream, error);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeLength = 246; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCode = - "(function (controller, error)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " const stream = @getByIdDirectPrivate(controller, \"stream\");\n" \ - " if (@getByIdDirectPrivate(stream, \"state\") === \"writable\")\n" \ - " @writableStreamDefaultControllerError(controller, error);\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeLength = 159; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCode = - "(function (controller)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " const desiredSize = @writableStreamDefaultControllerGetDesiredSize(controller);\n" \ - " return desiredSize <= 0;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeLength = 275; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCode = - "(function (controller, chunk)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " try {\n" \ - " return @getByIdDirectPrivate(controller, \"strategySizeAlgorithm\").@call(@undefined, chunk);\n" \ - " } catch (e) {\n" \ - " @writableStreamDefaultControllerErrorIfNeeded(controller, e);\n" \ - " return 1;\n" \ - " }\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeLength = 157; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCode = - "(function (controller)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " return @getByIdDirectPrivate(controller, \"strategyHWM\") - @getByIdDirectPrivate(controller, \"queue\").size;\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeLength = 646; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCode = - "(function (controller)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " const stream = @getByIdDirectPrivate(controller, \"stream\");\n" \ - "\n" \ - " @writableStreamMarkCloseRequestInFlight(stream);\n" \ - " @dequeueValue(@getByIdDirectPrivate(controller, \"queue\"));\n" \ - "\n" \ - " @assert(@getByIdDirectPrivate(controller, \"queue\").content?.isEmpty());\n" \ - "\n" \ - " const sinkClosePromise = @getByIdDirectPrivate(controller, \"closeAlgorithm\").@call();\n" \ - " @writableStreamDefaultControllerClearAlgorithms(controller);\n" \ - "\n" \ - " sinkClosePromise.@then(() => {\n" \ - " @writableStreamFinishInFlightClose(stream);\n" \ - " }, (reason) => {\n" \ - " @writableStreamFinishInFlightCloseWithError(stream, reason);\n" \ - " });\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeLength = 1165; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCode = - "(function (controller, chunk)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " const stream = @getByIdDirectPrivate(controller, \"stream\");\n" \ - "\n" \ - " @writableStreamMarkFirstWriteRequestInFlight(stream);\n" \ - "\n" \ - " const sinkWritePromise = @getByIdDirectPrivate(controller, \"writeAlgorithm\").@call(@undefined, chunk);\n" \ - "\n" \ - " sinkWritePromise.@then(() => {\n" \ - " @writableStreamFinishInFlightWrite(stream);\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - " @assert(state === \"writable\" || state === \"erroring\");\n" \ - "\n" \ - " @dequeueValue(@getByIdDirectPrivate(controller, \"queue\"));\n" \ - " if (!@writableStreamCloseQueuedOrInFlight(stream) && state === \"writable\") {\n" \ - " const backpressure = @writableStreamDefaultControllerGetBackpressure(controller);\n" \ - " @writableStreamUpdateBackpressure(stream, backpressure);\n" \ - " }\n" \ - " @writableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n" \ - " }, (reason) => {\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - " if (state === \"writable\")\n" \ - " @writableStreamDefaultControllerClearAlgorithms(controller);\n" \ - "\n" \ - " @writableStreamFinishInFlightWriteWithError(stream, reason);\n" \ - " });\n" \ - "})\n" \ -; - -const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; -const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeConstructorKind = JSC::ConstructorKind::None; -const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeLength = 725; -static const JSC::Intrinsic s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_writableStreamInternalsWritableStreamDefaultControllerWriteCode = - "(function (controller, chunk, chunkSize)\n" \ - "{\n" \ - " \"use strict\";\n" \ - " try {\n" \ - " @enqueueValueWithSize(@getByIdDirectPrivate(controller, \"queue\"), chunk, chunkSize);\n" \ - "\n" \ - " const stream = @getByIdDirectPrivate(controller, \"stream\");\n" \ - "\n" \ - " const state = @getByIdDirectPrivate(stream, \"state\");\n" \ - " if (!@writableStreamCloseQueuedOrInFlight(stream) && state === \"writable\") {\n" \ - " const backpressure = @writableStreamDefaultControllerGetBackpressure(controller);\n" \ - " @writableStreamUpdateBackpressure(stream, backpressure);\n" \ - " }\n" \ - " @writableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n" \ - " } catch (e) {\n" \ - " @writableStreamDefaultControllerErrorIfNeeded(controller, e);\n" \ - " }\n" \ - "})\n" \ -; - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().writableStreamInternalsBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().writableStreamInternalsBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/WritableStreamInternalsBuiltins.h b/src/bun.js/builtins/cpp/WritableStreamInternalsBuiltins.h deleted file mode 100644 index bc114276b..000000000 --- a/src/bun.js/builtins/cpp/WritableStreamInternalsBuiltins.h +++ /dev/null @@ -1,597 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2023 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* WritableStreamInternals */ -extern const char* const s_writableStreamInternalsIsWritableStreamCode; -extern const int s_writableStreamInternalsIsWritableStreamCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsIsWritableStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsIsWritableStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsIsWritableStreamCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsIsWritableStreamDefaultWriterCode; -extern const int s_writableStreamInternalsIsWritableStreamDefaultWriterCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsIsWritableStreamDefaultWriterCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsIsWritableStreamDefaultWriterCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsIsWritableStreamDefaultWriterCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsAcquireWritableStreamDefaultWriterCode; -extern const int s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsCreateWritableStreamCode; -extern const int s_writableStreamInternalsCreateWritableStreamCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsCreateWritableStreamCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsCreateWritableStreamCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsCreateWritableStreamCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCode; -extern const int s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsInitializeWritableStreamSlotsCode; -extern const int s_writableStreamInternalsInitializeWritableStreamSlotsCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsInitializeWritableStreamSlotsCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsInitializeWritableStreamSlotsCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsInitializeWritableStreamSlotsCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamCloseForBindingsCode; -extern const int s_writableStreamInternalsWritableStreamCloseForBindingsCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamCloseForBindingsCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamCloseForBindingsCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamCloseForBindingsCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamAbortForBindingsCode; -extern const int s_writableStreamInternalsWritableStreamAbortForBindingsCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamAbortForBindingsCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamAbortForBindingsCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamAbortForBindingsCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsIsWritableStreamLockedCode; -extern const int s_writableStreamInternalsIsWritableStreamLockedCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsIsWritableStreamLockedCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsIsWritableStreamLockedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsIsWritableStreamLockedCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsSetUpWritableStreamDefaultWriterCode; -extern const int s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamAbortCode; -extern const int s_writableStreamInternalsWritableStreamAbortCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamAbortCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamAbortCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamAbortCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamCloseCode; -extern const int s_writableStreamInternalsWritableStreamCloseCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamCloseCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamAddWriteRequestCode; -extern const int s_writableStreamInternalsWritableStreamAddWriteRequestCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamAddWriteRequestCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamAddWriteRequestCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamAddWriteRequestCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCode; -extern const int s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDealWithRejectionCode; -extern const int s_writableStreamInternalsWritableStreamDealWithRejectionCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDealWithRejectionCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDealWithRejectionCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDealWithRejectionCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamFinishErroringCode; -extern const int s_writableStreamInternalsWritableStreamFinishErroringCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishErroringCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishErroringCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishErroringCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamFinishInFlightCloseCode; -extern const int s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCode; -extern const int s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamFinishInFlightWriteCode; -extern const int s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCode; -extern const int s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCode; -extern const int s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCode; -extern const int s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCode; -extern const int s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCode; -extern const int s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamStartErroringCode; -extern const int s_writableStreamInternalsWritableStreamStartErroringCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamStartErroringCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamStartErroringCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamStartErroringCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamUpdateBackpressureCode; -extern const int s_writableStreamInternalsWritableStreamUpdateBackpressureCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamUpdateBackpressureCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamUpdateBackpressureCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamUpdateBackpressureCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultWriterAbortCode; -extern const int s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultWriterCloseCode; -extern const int s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCode; -extern const int s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCode; -extern const int s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCode; -extern const int s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCode; -extern const int s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultWriterReleaseCode; -extern const int s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultWriterWriteCode; -extern const int s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsSetUpWritableStreamDefaultControllerCode; -extern const int s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerStartCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerStartCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerStartCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerStartCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerStartCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCode; -extern const int s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsIsCloseSentinelCode; -extern const int s_writableStreamInternalsIsCloseSentinelCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsIsCloseSentinelCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsIsCloseSentinelCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsIsCloseSentinelCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerCloseCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerErrorCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeImplementationVisibility; -extern const char* const s_writableStreamInternalsWritableStreamDefaultControllerWriteCode; -extern const int s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeLength; -extern const JSC::ConstructAbility s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeConstructAbility; -extern const JSC::ConstructorKind s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeConstructorKind; -extern const JSC::ImplementationVisibility s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeImplementationVisibility; - -#define WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_DATA(macro) \ - macro(isWritableStream, writableStreamInternalsIsWritableStream, 1) \ - macro(isWritableStreamDefaultWriter, writableStreamInternalsIsWritableStreamDefaultWriter, 1) \ - macro(acquireWritableStreamDefaultWriter, writableStreamInternalsAcquireWritableStreamDefaultWriter, 1) \ - macro(createWritableStream, writableStreamInternalsCreateWritableStream, 6) \ - macro(createInternalWritableStreamFromUnderlyingSink, writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSink, 2) \ - macro(initializeWritableStreamSlots, writableStreamInternalsInitializeWritableStreamSlots, 2) \ - macro(writableStreamCloseForBindings, writableStreamInternalsWritableStreamCloseForBindings, 1) \ - macro(writableStreamAbortForBindings, writableStreamInternalsWritableStreamAbortForBindings, 2) \ - macro(isWritableStreamLocked, writableStreamInternalsIsWritableStreamLocked, 1) \ - macro(setUpWritableStreamDefaultWriter, writableStreamInternalsSetUpWritableStreamDefaultWriter, 2) \ - macro(writableStreamAbort, writableStreamInternalsWritableStreamAbort, 2) \ - macro(writableStreamClose, writableStreamInternalsWritableStreamClose, 1) \ - macro(writableStreamAddWriteRequest, writableStreamInternalsWritableStreamAddWriteRequest, 1) \ - macro(writableStreamCloseQueuedOrInFlight, writableStreamInternalsWritableStreamCloseQueuedOrInFlight, 1) \ - macro(writableStreamDealWithRejection, writableStreamInternalsWritableStreamDealWithRejection, 2) \ - macro(writableStreamFinishErroring, writableStreamInternalsWritableStreamFinishErroring, 1) \ - macro(writableStreamFinishInFlightClose, writableStreamInternalsWritableStreamFinishInFlightClose, 1) \ - macro(writableStreamFinishInFlightCloseWithError, writableStreamInternalsWritableStreamFinishInFlightCloseWithError, 2) \ - macro(writableStreamFinishInFlightWrite, writableStreamInternalsWritableStreamFinishInFlightWrite, 1) \ - macro(writableStreamFinishInFlightWriteWithError, writableStreamInternalsWritableStreamFinishInFlightWriteWithError, 2) \ - macro(writableStreamHasOperationMarkedInFlight, writableStreamInternalsWritableStreamHasOperationMarkedInFlight, 1) \ - macro(writableStreamMarkCloseRequestInFlight, writableStreamInternalsWritableStreamMarkCloseRequestInFlight, 1) \ - macro(writableStreamMarkFirstWriteRequestInFlight, writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlight, 1) \ - macro(writableStreamRejectCloseAndClosedPromiseIfNeeded, writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeeded, 1) \ - macro(writableStreamStartErroring, writableStreamInternalsWritableStreamStartErroring, 2) \ - macro(writableStreamUpdateBackpressure, writableStreamInternalsWritableStreamUpdateBackpressure, 2) \ - macro(writableStreamDefaultWriterAbort, writableStreamInternalsWritableStreamDefaultWriterAbort, 2) \ - macro(writableStreamDefaultWriterClose, writableStreamInternalsWritableStreamDefaultWriterClose, 1) \ - macro(writableStreamDefaultWriterCloseWithErrorPropagation, writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagation, 1) \ - macro(writableStreamDefaultWriterEnsureClosedPromiseRejected, writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejected, 2) \ - macro(writableStreamDefaultWriterEnsureReadyPromiseRejected, writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejected, 2) \ - macro(writableStreamDefaultWriterGetDesiredSize, writableStreamInternalsWritableStreamDefaultWriterGetDesiredSize, 1) \ - macro(writableStreamDefaultWriterRelease, writableStreamInternalsWritableStreamDefaultWriterRelease, 1) \ - macro(writableStreamDefaultWriterWrite, writableStreamInternalsWritableStreamDefaultWriterWrite, 2) \ - macro(setUpWritableStreamDefaultController, writableStreamInternalsSetUpWritableStreamDefaultController, 8) \ - macro(writableStreamDefaultControllerStart, writableStreamInternalsWritableStreamDefaultControllerStart, 1) \ - macro(setUpWritableStreamDefaultControllerFromUnderlyingSink, writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSink, 5) \ - macro(writableStreamDefaultControllerAdvanceQueueIfNeeded, writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeeded, 1) \ - macro(isCloseSentinel, writableStreamInternalsIsCloseSentinel, 0) \ - macro(writableStreamDefaultControllerClearAlgorithms, writableStreamInternalsWritableStreamDefaultControllerClearAlgorithms, 1) \ - macro(writableStreamDefaultControllerClose, writableStreamInternalsWritableStreamDefaultControllerClose, 1) \ - macro(writableStreamDefaultControllerError, writableStreamInternalsWritableStreamDefaultControllerError, 2) \ - macro(writableStreamDefaultControllerErrorIfNeeded, writableStreamInternalsWritableStreamDefaultControllerErrorIfNeeded, 2) \ - macro(writableStreamDefaultControllerGetBackpressure, writableStreamInternalsWritableStreamDefaultControllerGetBackpressure, 1) \ - macro(writableStreamDefaultControllerGetChunkSize, writableStreamInternalsWritableStreamDefaultControllerGetChunkSize, 2) \ - macro(writableStreamDefaultControllerGetDesiredSize, writableStreamInternalsWritableStreamDefaultControllerGetDesiredSize, 1) \ - macro(writableStreamDefaultControllerProcessClose, writableStreamInternalsWritableStreamDefaultControllerProcessClose, 1) \ - macro(writableStreamDefaultControllerProcessWrite, writableStreamInternalsWritableStreamDefaultControllerProcessWrite, 2) \ - macro(writableStreamDefaultControllerWrite, writableStreamInternalsWritableStreamDefaultControllerWrite, 3) \ - -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_ISWRITABLESTREAM 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_ISWRITABLESTREAMDEFAULTWRITER 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_ACQUIREWRITABLESTREAMDEFAULTWRITER 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_CREATEWRITABLESTREAM 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_CREATEINTERNALWRITABLESTREAMFROMUNDERLYINGSINK 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_INITIALIZEWRITABLESTREAMSLOTS 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMCLOSEFORBINDINGS 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMABORTFORBINDINGS 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_ISWRITABLESTREAMLOCKED 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_SETUPWRITABLESTREAMDEFAULTWRITER 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMABORT 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMCLOSE 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMADDWRITEREQUEST 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMCLOSEQUEUEDORINFLIGHT 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEALWITHREJECTION 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMFINISHERRORING 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMFINISHINFLIGHTCLOSE 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMFINISHINFLIGHTCLOSEWITHERROR 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMFINISHINFLIGHTWRITE 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMFINISHINFLIGHTWRITEWITHERROR 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMHASOPERATIONMARKEDINFLIGHT 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMMARKCLOSEREQUESTINFLIGHT 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMMARKFIRSTWRITEREQUESTINFLIGHT 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMREJECTCLOSEANDCLOSEDPROMISEIFNEEDED 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMSTARTERRORING 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMUPDATEBACKPRESSURE 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTWRITERABORT 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTWRITERCLOSE 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTWRITERCLOSEWITHERRORPROPAGATION 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTWRITERENSURECLOSEDPROMISEREJECTED 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTWRITERENSUREREADYPROMISEREJECTED 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTWRITERGETDESIREDSIZE 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTWRITERRELEASE 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTWRITERWRITE 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_SETUPWRITABLESTREAMDEFAULTCONTROLLER 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERSTART 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_SETUPWRITABLESTREAMDEFAULTCONTROLLERFROMUNDERLYINGSINK 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERADVANCEQUEUEIFNEEDED 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_ISCLOSESENTINEL 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERCLEARALGORITHMS 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERCLOSE 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERERROR 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERERRORIFNEEDED 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERGETBACKPRESSURE 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERGETCHUNKSIZE 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERGETDESIREDSIZE 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERPROCESSCLOSE 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERPROCESSWRITE 1 -#define WEBCORE_BUILTIN_WRITABLESTREAMINTERNALS_WRITABLESTREAMDEFAULTCONTROLLERWRITE 1 - -#define WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_CODE(macro) \ - macro(writableStreamInternalsIsWritableStreamCode, isWritableStream, ASCIILiteral(), s_writableStreamInternalsIsWritableStreamCodeLength) \ - macro(writableStreamInternalsIsWritableStreamDefaultWriterCode, isWritableStreamDefaultWriter, ASCIILiteral(), s_writableStreamInternalsIsWritableStreamDefaultWriterCodeLength) \ - macro(writableStreamInternalsAcquireWritableStreamDefaultWriterCode, acquireWritableStreamDefaultWriter, ASCIILiteral(), s_writableStreamInternalsAcquireWritableStreamDefaultWriterCodeLength) \ - macro(writableStreamInternalsCreateWritableStreamCode, createWritableStream, ASCIILiteral(), s_writableStreamInternalsCreateWritableStreamCodeLength) \ - macro(writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCode, createInternalWritableStreamFromUnderlyingSink, ASCIILiteral(), s_writableStreamInternalsCreateInternalWritableStreamFromUnderlyingSinkCodeLength) \ - macro(writableStreamInternalsInitializeWritableStreamSlotsCode, initializeWritableStreamSlots, ASCIILiteral(), s_writableStreamInternalsInitializeWritableStreamSlotsCodeLength) \ - macro(writableStreamInternalsWritableStreamCloseForBindingsCode, writableStreamCloseForBindings, ASCIILiteral(), s_writableStreamInternalsWritableStreamCloseForBindingsCodeLength) \ - macro(writableStreamInternalsWritableStreamAbortForBindingsCode, writableStreamAbortForBindings, ASCIILiteral(), s_writableStreamInternalsWritableStreamAbortForBindingsCodeLength) \ - macro(writableStreamInternalsIsWritableStreamLockedCode, isWritableStreamLocked, ASCIILiteral(), s_writableStreamInternalsIsWritableStreamLockedCodeLength) \ - macro(writableStreamInternalsSetUpWritableStreamDefaultWriterCode, setUpWritableStreamDefaultWriter, ASCIILiteral(), s_writableStreamInternalsSetUpWritableStreamDefaultWriterCodeLength) \ - macro(writableStreamInternalsWritableStreamAbortCode, writableStreamAbort, ASCIILiteral(), s_writableStreamInternalsWritableStreamAbortCodeLength) \ - macro(writableStreamInternalsWritableStreamCloseCode, writableStreamClose, ASCIILiteral(), s_writableStreamInternalsWritableStreamCloseCodeLength) \ - macro(writableStreamInternalsWritableStreamAddWriteRequestCode, writableStreamAddWriteRequest, ASCIILiteral(), s_writableStreamInternalsWritableStreamAddWriteRequestCodeLength) \ - macro(writableStreamInternalsWritableStreamCloseQueuedOrInFlightCode, writableStreamCloseQueuedOrInFlight, ASCIILiteral(), s_writableStreamInternalsWritableStreamCloseQueuedOrInFlightCodeLength) \ - macro(writableStreamInternalsWritableStreamDealWithRejectionCode, writableStreamDealWithRejection, ASCIILiteral(), s_writableStreamInternalsWritableStreamDealWithRejectionCodeLength) \ - macro(writableStreamInternalsWritableStreamFinishErroringCode, writableStreamFinishErroring, ASCIILiteral(), s_writableStreamInternalsWritableStreamFinishErroringCodeLength) \ - macro(writableStreamInternalsWritableStreamFinishInFlightCloseCode, writableStreamFinishInFlightClose, ASCIILiteral(), s_writableStreamInternalsWritableStreamFinishInFlightCloseCodeLength) \ - macro(writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCode, writableStreamFinishInFlightCloseWithError, ASCIILiteral(), s_writableStreamInternalsWritableStreamFinishInFlightCloseWithErrorCodeLength) \ - macro(writableStreamInternalsWritableStreamFinishInFlightWriteCode, writableStreamFinishInFlightWrite, ASCIILiteral(), s_writableStreamInternalsWritableStreamFinishInFlightWriteCodeLength) \ - macro(writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCode, writableStreamFinishInFlightWriteWithError, ASCIILiteral(), s_writableStreamInternalsWritableStreamFinishInFlightWriteWithErrorCodeLength) \ - macro(writableStreamInternalsWritableStreamHasOperationMarkedInFlightCode, writableStreamHasOperationMarkedInFlight, ASCIILiteral(), s_writableStreamInternalsWritableStreamHasOperationMarkedInFlightCodeLength) \ - macro(writableStreamInternalsWritableStreamMarkCloseRequestInFlightCode, writableStreamMarkCloseRequestInFlight, ASCIILiteral(), s_writableStreamInternalsWritableStreamMarkCloseRequestInFlightCodeLength) \ - macro(writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCode, writableStreamMarkFirstWriteRequestInFlight, ASCIILiteral(), s_writableStreamInternalsWritableStreamMarkFirstWriteRequestInFlightCodeLength) \ - macro(writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCode, writableStreamRejectCloseAndClosedPromiseIfNeeded, ASCIILiteral(), s_writableStreamInternalsWritableStreamRejectCloseAndClosedPromiseIfNeededCodeLength) \ - macro(writableStreamInternalsWritableStreamStartErroringCode, writableStreamStartErroring, ASCIILiteral(), s_writableStreamInternalsWritableStreamStartErroringCodeLength) \ - macro(writableStreamInternalsWritableStreamUpdateBackpressureCode, writableStreamUpdateBackpressure, ASCIILiteral(), s_writableStreamInternalsWritableStreamUpdateBackpressureCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultWriterAbortCode, writableStreamDefaultWriterAbort, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultWriterAbortCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultWriterCloseCode, writableStreamDefaultWriterClose, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultWriterCloseCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCode, writableStreamDefaultWriterCloseWithErrorPropagation, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultWriterCloseWithErrorPropagationCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCode, writableStreamDefaultWriterEnsureClosedPromiseRejected, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultWriterEnsureClosedPromiseRejectedCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCode, writableStreamDefaultWriterEnsureReadyPromiseRejected, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultWriterEnsureReadyPromiseRejectedCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCode, writableStreamDefaultWriterGetDesiredSize, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultWriterGetDesiredSizeCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultWriterReleaseCode, writableStreamDefaultWriterRelease, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultWriterReleaseCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultWriterWriteCode, writableStreamDefaultWriterWrite, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultWriterWriteCodeLength) \ - macro(writableStreamInternalsSetUpWritableStreamDefaultControllerCode, setUpWritableStreamDefaultController, ASCIILiteral(), s_writableStreamInternalsSetUpWritableStreamDefaultControllerCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerStartCode, writableStreamDefaultControllerStart, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerStartCodeLength) \ - macro(writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCode, setUpWritableStreamDefaultControllerFromUnderlyingSink, ASCIILiteral(), s_writableStreamInternalsSetUpWritableStreamDefaultControllerFromUnderlyingSinkCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCode, writableStreamDefaultControllerAdvanceQueueIfNeeded, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeLength) \ - macro(writableStreamInternalsIsCloseSentinelCode, isCloseSentinel, ASCIILiteral(), s_writableStreamInternalsIsCloseSentinelCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCode, writableStreamDefaultControllerClearAlgorithms, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerClearAlgorithmsCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerCloseCode, writableStreamDefaultControllerClose, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerCloseCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerErrorCode, writableStreamDefaultControllerError, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerErrorCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCode, writableStreamDefaultControllerErrorIfNeeded, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerErrorIfNeededCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCode, writableStreamDefaultControllerGetBackpressure, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerGetBackpressureCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCode, writableStreamDefaultControllerGetChunkSize, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerGetChunkSizeCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCode, writableStreamDefaultControllerGetDesiredSize, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerGetDesiredSizeCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerProcessCloseCode, writableStreamDefaultControllerProcessClose, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerProcessCloseCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerProcessWriteCode, writableStreamDefaultControllerProcessWrite, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerProcessWriteCodeLength) \ - macro(writableStreamInternalsWritableStreamDefaultControllerWriteCode, writableStreamDefaultControllerWrite, ASCIILiteral(), s_writableStreamInternalsWritableStreamDefaultControllerWriteCodeLength) \ - -#define WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(macro) \ - macro(acquireWritableStreamDefaultWriter) \ - macro(createInternalWritableStreamFromUnderlyingSink) \ - macro(createWritableStream) \ - macro(initializeWritableStreamSlots) \ - macro(isCloseSentinel) \ - macro(isWritableStream) \ - macro(isWritableStreamDefaultWriter) \ - macro(isWritableStreamLocked) \ - macro(setUpWritableStreamDefaultController) \ - macro(setUpWritableStreamDefaultControllerFromUnderlyingSink) \ - macro(setUpWritableStreamDefaultWriter) \ - macro(writableStreamAbort) \ - macro(writableStreamAbortForBindings) \ - macro(writableStreamAddWriteRequest) \ - macro(writableStreamClose) \ - macro(writableStreamCloseForBindings) \ - macro(writableStreamCloseQueuedOrInFlight) \ - macro(writableStreamDealWithRejection) \ - macro(writableStreamDefaultControllerAdvanceQueueIfNeeded) \ - macro(writableStreamDefaultControllerClearAlgorithms) \ - macro(writableStreamDefaultControllerClose) \ - macro(writableStreamDefaultControllerError) \ - macro(writableStreamDefaultControllerErrorIfNeeded) \ - macro(writableStreamDefaultControllerGetBackpressure) \ - macro(writableStreamDefaultControllerGetChunkSize) \ - macro(writableStreamDefaultControllerGetDesiredSize) \ - macro(writableStreamDefaultControllerProcessClose) \ - macro(writableStreamDefaultControllerProcessWrite) \ - macro(writableStreamDefaultControllerStart) \ - macro(writableStreamDefaultControllerWrite) \ - macro(writableStreamDefaultWriterAbort) \ - macro(writableStreamDefaultWriterClose) \ - macro(writableStreamDefaultWriterCloseWithErrorPropagation) \ - macro(writableStreamDefaultWriterEnsureClosedPromiseRejected) \ - macro(writableStreamDefaultWriterEnsureReadyPromiseRejected) \ - macro(writableStreamDefaultWriterGetDesiredSize) \ - macro(writableStreamDefaultWriterRelease) \ - macro(writableStreamDefaultWriterWrite) \ - macro(writableStreamFinishErroring) \ - macro(writableStreamFinishInFlightClose) \ - macro(writableStreamFinishInFlightCloseWithError) \ - macro(writableStreamFinishInFlightWrite) \ - macro(writableStreamFinishInFlightWriteWithError) \ - macro(writableStreamHasOperationMarkedInFlight) \ - macro(writableStreamMarkCloseRequestInFlight) \ - macro(writableStreamMarkFirstWriteRequestInFlight) \ - macro(writableStreamRejectCloseAndClosedPromiseIfNeeded) \ - macro(writableStreamStartErroring) \ - macro(writableStreamUpdateBackpressure) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class WritableStreamInternalsBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit WritableStreamInternalsBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* WritableStreamInternalsBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void WritableStreamInternalsBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -class WritableStreamInternalsBuiltinFunctions { -public: - explicit WritableStreamInternalsBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { } - - void init(JSC::JSGlobalObject&); - template<typename Visitor> void visit(Visitor&); - -public: - JSC::VM& m_vm; - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \ - JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function; - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS -}; - -inline void WritableStreamInternalsBuiltinFunctions::init(JSC::JSGlobalObject& globalObject) -{ -#define EXPORT_FUNCTION(codeName, functionName, overriddenName, length)\ - m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject)); - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_CODE(EXPORT_FUNCTION) -#undef EXPORT_FUNCTION -} - -template<typename Visitor> -inline void WritableStreamInternalsBuiltinFunctions::visit(Visitor& visitor) -{ -#define VISIT_FUNCTION(name) visitor.append(m_##name##Function); - WEBCORE_FOREACH_WRITABLESTREAMINTERNALS_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION) -#undef VISIT_FUNCTION -} - -template void WritableStreamInternalsBuiltinFunctions::visit(JSC::AbstractSlotVisitor&); -template void WritableStreamInternalsBuiltinFunctions::visit(JSC::SlotVisitor&); - - - -} // namespace WebCore |