You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a5f67b2
Browse filesBrowse the repository at this point in the historyBrowse files
[JSC] Implment @InternalPromise.@internalAll in C++
https://bugs.webkit.org/show_bug.cgi?id=303965
Reviewed by Yusuke Suzuki.
This patch reverts 304888@main to reland 304331@main.
The original patch used PromiseAllResolveJob which calls resolve() to settle
the result promise. However, resolve() looks up the "then" property on the
resolution value, which can have user-observable side effects. For example,
if Object.prototype.then is set to a custom function, it would be called
when resolving the result array, breaking the InternalPromise pipeline.
InternalPromise requires using fulfill() instead of resolve() because
fulfill() directly settles the promise without looking up "then". This is
the key difference between InternalPromise and regular Promise - InternalPromise
must not trigger any user-observable operations.
This patch:
- Adds InternalPromiseAllResolveJob which uses fulfill() instead of resolve()
- Updates JSInternalPromiseConstructor to use InternalPromiseAllResolveJob
- Also uses fulfill() for the empty array case
- Adds a test to verify Object.prototype.then is not called through module loader
---
This patch changes to implement `@InternalPromiseAll.@internalAll` in C++.
TipOfTree Patched
internal-promise-internal-all 7.2714+-0.6089 ^ 4.1862+-0.2744 ^ definitely 1.7370x faster
* JSTests/microbenchmarks/internal-promise-internal-all.js: Added.
* JSTests/modules/object-prototype-then-should-not-be-called-through-internal-promise.js: Added.
(Object.prototype.then):
* JSTests/modules/object-prototype-then-should-not-be-called-through-internal-promise/test.js: Added.
* Source/JavaScriptCore/CMakeLists.txt:
* Source/JavaScriptCore/DerivedSources-input.xcfilelist:
* Source/JavaScriptCore/DerivedSources.make:
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/builtins/InternalPromiseConstructor.js: Removed.
* Source/JavaScriptCore/runtime/JSInternalPromiseConstructor.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/JSMicrotask.cpp:
(JSC::internalPromiseAllResolveJob):
(JSC::runInternalMicrotask):
* Source/JavaScriptCore/runtime/Microtask.h:
Canonical link: https://commits.webkit.org/304930@main
0 commit comments