[webkit-changes] [WebKit/WebKit] 7e3fb3: [JSC] Add support for Atomics.waitAsync

EWS noreply at github.com
Mon Nov 28 00:13:55 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7e3fb31d598706ca0d25f05030fa41fbfb458566
      https://github.com/WebKit/WebKit/commit/7e3fb31d598706ca0d25f05030fa41fbfb458566
  Author: Yijia Huang <yijia_huang at apple.com>
  Date:   2022-11-28 (Mon, 28 Nov 2022)

  Changed paths:
    M JSTests/stress/SharedArrayBuffer.js
    M JSTests/stress/bigint-atomics-fail.js
    A JSTests/stress/settimeout-starvation.js
    M JSTests/stress/shared-array-buffer-bigint.js
    A JSTests/stress/waitasync-notify-multi-workers.js
    A JSTests/stress/waitasync-promise-timeout-finite-gc.js
    A JSTests/stress/waitasync-promise-timeout-infinity-gc.js
    A JSTests/stress/waitasync-timeout-finite-gc.js
    A JSTests/stress/waitasync-timeout-infinity-gc.js
    A JSTests/stress/waitasync-wait-infinity-notify-all-multi-workers.js
    A JSTests/stress/waitasync-wait-infinity-notify-half-multi-workers.js
    A JSTests/stress/waitasync-wait-timeout-multi-workers.js
    A JSTests/stress/waitasync-waiter-list-order.js
    M JSTests/test262/config.yaml
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M Source/JavaScriptCore/Sources.txt
    M Source/JavaScriptCore/jsc.cpp
    M Source/JavaScriptCore/runtime/ArrayBuffer.cpp
    M Source/JavaScriptCore/runtime/ArrayBuffer.h
    M Source/JavaScriptCore/runtime/AtomicsObject.cpp
    M Source/JavaScriptCore/runtime/AtomicsObject.h
    M Source/JavaScriptCore/runtime/Intrinsic.h
    M Source/JavaScriptCore/runtime/JSGlobalObject.h
    M Source/JavaScriptCore/runtime/OptionsList.h
    M Source/JavaScriptCore/runtime/VM.cpp
    M Source/JavaScriptCore/runtime/VM.h
    A Source/JavaScriptCore/runtime/WaiterListManager.cpp
    A Source/JavaScriptCore/runtime/WaiterListManager.h
    M Source/WTF/wtf/RunLoop.cpp
    M Source/WTF/wtf/RunLoop.h
    M Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
    M Source/WebCore/platform/ScrollingEffectsController.h

  Log Message:
  -----------
  [JSC] Add support for Atomics.waitAsync
https://bugs.webkit.org/show_bug.cgi?id=241414
rdar://94655073

Reviewed by Yusuke Suzuki.

Atomics.waitAsync() waits asynchronously on a shared array buffer and
returns an object { async: bool, value: Promise }. Compare to Atomics.wait(),
waitAsync is non-blocking and usable on the main thread.

TC39 Spec: https://tc39.es/proposal-atomics-wait-async/
TC39 Proposal: https://github.com/tc39/proposal-atomics-wait-async
MDN Web Doc: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/waitAsync

* JSTests/stress/settimeout-starvation.js: Added.
(let.promise.new.Promise):
(wait):
* JSTests/test262/config.yaml:
* Source/JavaScriptCore/jsc.cpp:
(JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/AtomicsObject.cpp:
(JSC::atomicsWaitImpl):
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/Intrinsic.cpp:
(JSC::intrinsicName):
* Source/JavaScriptCore/runtime/Intrinsic.h:
* Source/JavaScriptCore/runtime/JSArrayBufferView.h:
(JSC::JSArrayBufferView::hasArrayBuffer const):
* Source/JavaScriptCore/runtime/JSGlobalObject.h:
* Source/JavaScriptCore/runtime/SimpleTypedArrayController.cpp:
(JSC::SimpleTypedArrayController::isAtomicsWaitAsyncAllowedOnCurrentThread):
* Source/JavaScriptCore/runtime/SimpleTypedArrayController.h:
* Source/JavaScriptCore/runtime/TypedArrayController.h:
* Source/JavaScriptCore/runtime/VM.cpp:
(JSC::VM::~VM):
* Source/JavaScriptCore/runtime/WaiterListsManager.h: Added.
(JSC::Waiter::Waiter):
(JSC::Waiter::isAsync const):
(JSC::Waiter::getVM const):
(JSC::Waiter::getPromise const):
(JSC::Waiter::getTicket const):
(JSC::Waiter::dump const):
(JSC::WaiterList::enqueue):
(JSC::WaiterList::dequeue):
(JSC::WaiterList::takeFirst):
(JSC::WaiterList::isEmpty):
(JSC::WaiterList::dump const):
(JSC::WaiterListsManager::singleton):
(JSC::WaiterListsManager::addWaiter):
(JSC::WaiterListsManager::notifyWaiter):
(JSC::WaiterListsManager::timeoutAsyncWaiter):
(JSC::WaiterListsManager::unregister):
(JSC::WaiterListsManager::dump const):
(JSC::WaiterListsManager::RegisteredVMs::add):
(JSC::WaiterListsManager::RegisteredVMs::remove):
(JSC::WaiterListsManager::RegisteredVMs::contains):
(JSC::WaiterListsManager::RegisteredVMs::dump const):
(JSC::WaiterListsManager::notifyWaiterImpl):
(JSC::WaiterListsManager::add):
(JSC::WaiterListsManager::find):
* Source/WebCore/bindings/js/WebCoreTypedArrayController.cpp:
(WebCore::WebCoreTypedArrayController::isAtomicsWaitAsyncAllowedOnCurrentThread):
* Source/WebCore/bindings/js/WebCoreTypedArrayController.h:

Canonical link: https://commits.webkit.org/257061@main




More information about the webkit-changes mailing list