Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: dde627a1d427e3930c0ef958d16b5d57fb473d19
      
https://github.com/WebKit/WebKit/commit/dde627a1d427e3930c0ef958d16b5d57fb473d19
  Author: Yusuke Suzuki <[email protected]>
  Date:   2026-05-08 (Fri, 08 May 2026)

  Changed paths:
    M Source/JavaScriptCore/runtime/ButterflyInlines.h
    M Source/JavaScriptCore/runtime/JSArray.cpp
    M Source/JavaScriptCore/runtime/JSObject.cpp

  Log Message:
  -----------
  [JSC] Add realloc-and-shift fast path for JSArray unshift
https://bugs.webkit.org/show_bug.cgi?id=314384
rdar://176538469

Reviewed by Yijia Huang.

We had FIXME: JSArray unshift reallocates the underlying butterfly,
copying the old content to the new one, then shifting the range to
allocate the region. But this is wasteful as it is copying array
elements twice. When we need to reallocate a new butterfly, we should do
copy and shift at the same time.

* Source/JavaScriptCore/runtime/ButterflyInlines.h:
(JSC::nextLength):
* Source/JavaScriptCore/runtime/JSArray.cpp:
(JSC::tryGrowAndShiftButterflyRight):
(JSC::JSArray::unshiftCountWithAnyIndexingType):
* Source/JavaScriptCore/runtime/JSObject.cpp:
(JSC::nextLength): Deleted.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to