Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cab8cdc40a6f3ab6e3943053356f3cd21a2d9e81
      
https://github.com/WebKit/WebKit/commit/cab8cdc40a6f3ab6e3943053356f3cd21a2d9e81
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-06-29 (Mon, 29 Jun 2026)

  Changed paths:
    A JSTests/microbenchmarks/regexp-prototype-flags-getter.js
    A JSTests/stress/regexp-flags-getter-fast-path.js
    M Source/JavaScriptCore/runtime/RegExpPrototype.cpp

  Log Message:
  -----------
  [JSC] Add fast path for `RegExp#flags` getter
https://bugs.webkit.org/show_bug.cgi?id=318008

Reviewed by Yusuke Suzuki.

Every read of RegExp.prototype.flags performs eight generic property gets on the
receiver, each landing in a host getter on RegExp.prototype, even when nothing 
is
overridden.

Add a fast path that builds the flags string directly from the RegExp's flag 
bits
when the receiver is an unmodified RegExpObject covered by
regExpPrimordialPropertiesWatchpointSet.

                                        Baseline                  Patched

regexp-prototype-flags-getter      328.2361+-8.0599     ^     32.6714+-0.8326   
     ^ definitely 10.0466x faster

Tests: JSTests/microbenchmarks/regexp-prototype-flags-getter.js
       JSTests/stress/regexp-flags-getter-fast-path.js

* JSTests/microbenchmarks/regexp-prototype-flags-getter.js: Added.
* JSTests/stress/regexp-flags-getter-fast-path.js: Added.
(shouldBe):
(get global):
(PlainSubclass):
(OverridingSubclass.prototype.get global):
(OverridingSubclass):
* Source/JavaScriptCore/runtime/RegExpPrototype.cpp:
(JSC::regExpFlagsWatchpointIsValid):
(JSC::JSC_DEFINE_HOST_FUNCTION):

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



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

Reply via email to