[webkit-changes] [WebKit/WebKit] 668e78: Micro-optimize jsStringWithCache()

Chris Dumez noreply at github.com
Fri Apr 7 09:44:42 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 668e78fa29ae0a403cfc8a34b7973e6965658b00
      https://github.com/WebKit/WebKit/commit/668e78fa29ae0a403cfc8a34b7973e6965658b00
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-04-07 (Fri, 07 Apr 2023)

  Changed paths:
    M Source/JavaScriptCore/runtime/JSString.cpp
    M Source/JavaScriptCore/runtime/JSString.h

  Log Message:
  -----------
  Micro-optimize jsStringWithCache()
https://bugs.webkit.org/show_bug.cgi?id=255106

Reviewed by Geoffrey Garen.

Micro-optimize jsStringWithCache():
- Call JSString::getValueImpl() instead of tryGetValueImpl() on the cached
  JSString. We know we never cache JSRopeStrings.
- Call JSString::create() directly in the slow path instead of jsString()
  to avoid special handling of strings with length 0 and 1. It is unecessary
  since the fast path in jsStringWithCache() already did this special handling.

* Source/JavaScriptCore/runtime/JSString.cpp:
(JSC::jsStringWithCacheSlowCase):
* Source/JavaScriptCore/runtime/JSString.h:
(JSC::jsStringWithCache):

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




More information about the webkit-changes mailing list