[webkit-changes] [WebKit/WebKit] ad82b5: [JSC] Use libpas' zeroed-allocation for zero-filli...

Yusuke Suzuki noreply at github.com
Thu Aug 3 00:22:43 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ad82b5545b504a00555bc7f6d8f6fb94bb8dc896
      https://github.com/WebKit/WebKit/commit/ad82b5545b504a00555bc7f6d8f6fb94bb8dc896
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-08-03 (Thu, 03 Aug 2023)

  Changed paths:
    M Source/JavaScriptCore/runtime/ArrayBuffer.cpp
    M Source/JavaScriptCore/runtime/JSArrayBufferView.cpp
    M Source/WTF/wtf/FastMalloc.cpp
    M Source/WTF/wtf/Gigacage.cpp
    M Source/WTF/wtf/Gigacage.h
    M Source/bmalloc/bmalloc/bmalloc.h

  Log Message:
  -----------
  [JSC] Use libpas' zeroed-allocation for zero-filling typed array allocations
https://bugs.webkit.org/show_bug.cgi?id=259765
rdar://113315414

Reviewed by Mark Lam.

It turned out that large typed array can consume long time for zeroing its backing store.
But libpas already knows that this is zero-filled or not (for example, newly allocated pages are zeroed),
and libpas have try_allocate_zeroed APIs to return efficiently zero-filled memory.
This patch leverages this for TypedArray allocations.

* Source/JavaScriptCore/runtime/ArrayBuffer.cpp:
(JSC::ArrayBufferContents::tryAllocate):
* Source/JavaScriptCore/runtime/JSArrayBufferView.cpp:
(JSC::JSArrayBufferView::ConstructionContext::ConstructionContext):
* Source/WTF/wtf/FastMalloc.cpp:
(WTF::fastZeroedMalloc):
(WTF::tryFastZeroedMalloc):
* Source/WTF/wtf/Gigacage.cpp:
(Gigacage::tryZeroedMalloc):
(Gigacage::zeroedMalloc):
* Source/WTF/wtf/Gigacage.h:
* Source/bmalloc/bmalloc/bmalloc.h:
(bmalloc::api::tryZeroedMalloc):
(bmalloc::api::zeroedMalloc):

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




More information about the webkit-changes mailing list