diff options
Diffstat (limited to 'src/bun.js/builtins/cpp/WritableStreamInternalsBuiltins.cpp')
-rw-r--r-- | src/bun.js/builtins/cpp/WritableStreamInternalsBuiltins.cpp | 1183 |
1 files changed, 1183 insertions, 0 deletions
diff --git a/src/bun.js/builtins/cpp/WritableStreamInternalsBuiltins.cpp b/src/bun.js/builtins/cpp/WritableStreamInternalsBuiltins.cpp new file mode 100644 index 000000000..34a680bdc --- /dev/null +++ b/src/bun.js/builtins/cpp/WritableStreamInternalsBuiltins.cpp @@ -0,0 +1,1183 @@ +/* + * 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) 2022 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/HeapInlines.h> +#include <JavaScriptCore/IdentifierInlines.h> +#include <JavaScriptCore/Intrinsic.h> +#include <JavaScriptCore/JSCJSValueInlines.h> +#include <JavaScriptCore/JSCellInlines.h> +#include <JavaScriptCore/StructureInlines.h> +#include <JavaScriptCore/VM.h> + +namespace WebCore { + +const JSC::ConstructAbility s_writableStreamInternalsIsWritableStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const JSC::ConstructorKind s_writableStreamInternalsIsWritableStreamCodeConstructorKind = JSC::ConstructorKind::None; +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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 int s_writableStreamInternalsWritableStreamDefaultControllerAdvanceQueueIfNeededCodeLength = 895; +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" \ + " if (@getByIdDirectPrivate(controller, \"queue\").content?.isEmpty() ?? false)\n" \ + " return;\n" \ + "\n" \ + " const value = @peekQueueValue(@getByIdDirectPrivate(controller, \"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 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 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 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 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 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 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 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 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 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 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 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 |