[webkit-changes] [WebKit/WebKit] e66d49: [JSC] Do not use gcSafeMemcpy etc. when it is not ...

Yusuke Suzuki noreply at github.com
Fri Aug 9 09:54:51 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e66d49b789e7c90ff6e8c18ed802fe04a0508d23
      https://github.com/WebKit/WebKit/commit/e66d49b789e7c90ff6e8c18ed802fe04a0508d23
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2024-08-09 (Fri, 09 Aug 2024)

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

  Log Message:
  -----------
  [JSC] Do not use gcSafeMemcpy etc. when it is not necessary
https://bugs.webkit.org/show_bug.cgi?id=277846
rdar://133516497

Reviewed by Keith Miller.

We found that gcSafeMemcpy etc. are costly than memcpy etc. And right now we are using it too conservatively.
For example, if the butterfly is not tied to any JSObject yet, we do not need to use gcSafeMemcpy since it
will not be scanned by GC. This patch fixes various conservative gcSafeMemcpy with memcpy to leverage super
fast & compiler-aided implementation of memcpy.

* Source/JavaScriptCore/runtime/ArrayPrototype.cpp:
(JSC::copyElements):
* Source/JavaScriptCore/runtime/ButterflyInlines.h:
(JSC::Butterfly::tryCreate):
(JSC::Butterfly::createOrGrowPropertyStorage):
(JSC::Butterfly::growArrayRight):
(JSC::Butterfly::reallocArrayRightIfPossible):
(JSC::Butterfly::resizeArray):
* Source/JavaScriptCore/runtime/JSArray.cpp:
(JSC::JSArray::appendMemcpy):
(JSC::JSArray::fastSlice):
* Source/JavaScriptCore/runtime/JSObject.cpp:
(JSC::JSObject::constructConvertedArrayStorageWithoutCopyingElements):
(JSC::JSObject::convertFromCopyOnWrite):
(JSC::JSObject::shiftButterflyAfterFlattening):
* Source/JavaScriptCore/runtime/ObjectConstructorInlines.h:
(JSC::objectCloneFast):
(JSC::tryCreateObjectViaCloning):

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



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


More information about the webkit-changes mailing list