[webkit-changes] [WebKit/WebKit] 0aebf7: [JSC] optimize `Promise.withResolvers` to avoid un...
Devin Rousso
noreply at github.com
Thu Jul 13 09:37:09 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 0aebf750430c0f2bf1ad6b96a6d38c9640c63056
https://github.com/WebKit/WebKit/commit/0aebf750430c0f2bf1ad6b96a6d38c9640c63056
Author: Devin Rousso <hi at devinrousso.com>
Date: 2023-07-13 (Thu, 13 Jul 2023)
Changed paths:
M Source/JavaScriptCore/builtins/ModuleLoader.js
M Source/JavaScriptCore/builtins/PromiseConstructor.js
M Source/JavaScriptCore/builtins/PromiseOperations.js
M Source/JavaScriptCore/builtins/PromisePrototype.js
M Source/JavaScriptCore/runtime/JSPromise.cpp
M Source/WebCore/Modules/streams/ReadableStreamBYOBReader.js
M Source/WebCore/Modules/streams/ReadableStreamDefaultReader.js
M Source/WebCore/Modules/streams/ReadableStreamInternals.js
M Source/WebCore/Modules/streams/TransformStreamInternals.js
M Source/WebCore/Modules/streams/WritableStreamDefaultWriter.js
M Source/WebCore/Modules/streams/WritableStreamInternals.js
Log Message:
-----------
[JSC] optimize `Promise.withResolvers` to avoid unnecessary object construction
https://bugs.webkit.org/show_bug.cgi?id=259175
Reviewed by Yusuke Suzuki.
Rework `newPromiseCapability` (and `newPromiseCapabilitySlow`) to return an object containing `promise`/`resolve`/`reject` instead of `@promise`/`@resolve`/`@reject` so that `Promise.withResolvers` can directly use it instead of transforming it into another object.
As a result, update all the other callsites that use `@promise`/`@resolve`/`@reject` to use `promise`/`resolve`/`reject` as well.
* Source/JavaScriptCore/builtins/ModuleLoader.js:
(fulfillFetch):
* Source/JavaScriptCore/builtins/PromiseConstructor.js:
(promiseAllSlow):
(promiseNewOnRejected):
(allSettled):
(any):
(race):
(withResolvers):
* Source/JavaScriptCore/builtins/PromiseOperations.js:
(newPromiseCapabilitySlow):
(newPromiseCapability):
(promiseResolveSlow):
(promiseRejectSlow):
(createResolvingFunctions):
(createResolvingFunctionsWithoutPromise):
(promiseReactionJob):
(promiseResolveThenableJob):
(promiseResolveThenableJobWithDerivedPromise):
* Source/JavaScriptCore/builtins/PromisePrototype.js:
(then):
* Source/JavaScriptCore/runtime/JSPromise.cpp:
(JSC::JSPromise::convertCapabilityToDeferredData):
* Source/WebCore/Modules/streams/ReadableStreamBYOBReader.js:
(closed):
* Source/WebCore/Modules/streams/ReadableStreamDefaultReader.js:
(closed):
* Source/WebCore/Modules/streams/ReadableStreamInternals.js:
(readableStreamReaderGenericInitialize):
(readableStreamPipeTo):
(readableStreamPipeToWritableStream):
(pipeToErrorsMustBePropagatedForward):
(pipeToErrorsMustBePropagatedBackward):
(pipeToClosingMustBePropagatedForward):
(pipeToShutdownWithAction):
(pipeToShutdown):
(pipeToFinalize):
(readableStreamTee):
(pullAlgorithm):
(readableStreamTeePullFunction):
(readableStreamTeeBranch1CancelFunction):
(readableStreamTeeBranch2CancelFunction):
(readableStreamError):
(readableStreamClose):
(readableStreamReaderGenericRelease):
* Source/WebCore/Modules/streams/TransformStreamInternals.js:
(createInternalTransformStreamFromTransformer):
(createTransformStream):
(transformStreamSetBackpressure):
(transformStreamDefaultControllerPerformTransform):
(transformStreamDefaultSinkWriteAlgorithm):
(transformStreamDefaultSinkCloseAlgorithm):
(transformStreamDefaultSourcePullAlgorithm):
* Source/WebCore/Modules/streams/WritableStreamDefaultWriter.js:
(closed):
(ready):
* Source/WebCore/Modules/streams/WritableStreamInternals.js:
(setUpWritableStreamDefaultWriter):
(writableStreamAbort):
(writableStreamClose):
(writableStreamAddWriteRequest):
(writableStreamFinishErroring):
(writableStreamFinishInFlightWrite):
(writableStreamFinishInFlightWriteWithError):
(writableStreamRejectCloseAndClosedPromiseIfNeeded):
(writableStreamUpdateBackpressure):
(writableStreamDefaultWriterEnsureClosedPromiseRejected):
(writableStreamDefaultWriterEnsureReadyPromiseRejected):
Canonical link: https://commits.webkit.org/266036@main
More information about the webkit-changes
mailing list