[webkit-changes] [WebKit/WebKit] 1d11bc: [JSC] Heap allocation during WebAudio rendering

Chris Dumez noreply at github.com
Thu Jun 1 16:29:21 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1d11bc8cd5be50034490cc0b3e0fc569e1a7ae31
      https://github.com/WebKit/WebKit/commit/1d11bc8cd5be50034490cc0b3e0fc569e1a7ae31
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-06-01 (Thu, 01 Jun 2023)

  Changed paths:
    M Source/JavaScriptCore/runtime/VM.cpp
    M Source/JavaScriptCore/runtime/VM.h
    M Source/WebCore/Modules/webaudio/AudioWorkletGlobalScope.cpp
    M Source/WebCore/Modules/webaudio/AudioWorkletGlobalScope.h

  Log Message:
  -----------
  [JSC] Heap allocation during WebAudio rendering
https://bugs.webkit.org/show_bug.cgi?id=257488
rdar://110012510

Reviewed by Yusuke Suzuki.

Avoid a potential heap allocation under AudioWorkletGlobalScope::handlePreRenderTasks()
caused by grabbing the JSLock. Since the intention of grabbing the JSLock here is to
delay the draining of the microtasks queue until handlePostRenderTasks(), I introduce
instead a DrainMicrotaskDelayScope which delays draining of the microtasks queue without
grabbing the JSLock until the moment we want to drain the queue.

* Source/JavaScriptCore/runtime/VM.cpp:
(JSC::VM::drainMicrotasks):
(JSC::VM::DrainMicrotaskDelayScope::DrainMicrotaskDelayScope):
(JSC::VM::DrainMicrotaskDelayScope::~DrainMicrotaskDelayScope):
(JSC::VM::DrainMicrotaskDelayScope::operator=):
(JSC::VM::DrainMicrotaskDelayScope::increment):
(JSC::VM::DrainMicrotaskDelayScope::decrement):
* Source/JavaScriptCore/runtime/VM.h:
(JSC::VM::drainMicrotaskDelayScope):
* Source/WebCore/Modules/webaudio/AudioWorkletGlobalScope.cpp:
(WebCore::AudioWorkletGlobalScope::handlePreRenderTasks):
(WebCore::AudioWorkletGlobalScope::handlePostRenderTasks):
* Source/WebCore/Modules/webaudio/AudioWorkletGlobalScope.h:

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




More information about the webkit-changes mailing list