Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 04edf7716a74170fb0967ffe7df687ff6b654b93
      
https://github.com/WebKit/WebKit/commit/04edf7716a74170fb0967ffe7df687ff6b654b93
  Author: Yusuke Suzuki <ysuz...@apple.com>
  Date:   2025-02-28 (Fri, 28 Feb 2025)

  Changed paths:
    A JSTests/stress/trim-regexp.js
    M Source/JavaScriptCore/runtime/RegExp.cpp
    M Source/JavaScriptCore/runtime/RegExp.h
    M Source/JavaScriptCore/runtime/StringPrototype.cpp
    M Source/JavaScriptCore/yarr/Yarr.h
    M Source/JavaScriptCore/yarr/YarrPattern.cpp
    M Source/JavaScriptCore/yarr/YarrPattern.h

  Log Message:
  -----------
  [JSC] Detect trimming pattern in RegExp
https://bugs.webkit.org/show_bug.cgi?id=288784
rdar://145802871

Reviewed by Yijia Huang.

Because of old lack of trimming function, we tend to see RegExp based
trimming operation (trimStart / trimEnd), and we would like to make them
super efficient since it is too frequently happening. This patch
extracts this pattern from Yarr and do C++ implementation for that.

* JSTests/stress/trim-regexp.js: Added.
(shouldBe):
(string_appeared_here.replace):
* Source/JavaScriptCore/runtime/RegExp.cpp:
(JSC::RegExp::finishCreation):
(JSC::RegExp::byteCodeCompileIfNecessary):
(JSC::RegExp::compile):
(JSC::RegExp::compileMatchOnly):
(JSC::RegExp::deleteCode):
* Source/JavaScriptCore/runtime/RegExp.h:
* Source/JavaScriptCore/runtime/StringPrototype.cpp:
(JSC::tryTrimSpaces):
(JSC::replaceUsingRegExpSearch):
* Source/JavaScriptCore/yarr/Yarr.h:
* Source/JavaScriptCore/yarr/YarrPattern.cpp:
(JSC::Yarr::YarrPatternConstructor::extractSpecificPattern):
(JSC::Yarr::YarrPattern::compile):
(JSC::Yarr::YarrPattern::dumpPattern):
(JSC::Yarr::YarrPatternConstructor::extractAtom): Deleted.
* Source/JavaScriptCore/yarr/YarrPattern.h:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to