Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d1ae3398fd0584ee719c6577a9b2840126563f1f
      
https://github.com/WebKit/WebKit/commit/d1ae3398fd0584ee719c6577a9b2840126563f1f
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-03-27 (Fri, 27 Mar 2026)

  Changed paths:
    M Source/JavaScriptCore/parser/ASTBuilder.h
    M Source/JavaScriptCore/parser/Parser.cpp
    M Source/JavaScriptCore/parser/SyntaxChecker.h

  Log Message:
  -----------
  [JSC] Skip redundant RegExp syntax check when reparsing a function
https://bugs.webkit.org/show_bug.cgi?id=310785

Reviewed by Yusuke Suzuki.

ASTBuilder::createRegExp calls Yarr::checkSyntax on every regexp literal,
including during lazy compilation of a function body. But the enclosing
script's initial parse already validated these literals via SyntaxChecker
— as the existing comment in Parser::parse notes, we can never see a
syntax error when reparsing a function.

Pass isReparsingFunction() to createRegExp so it can skip the redundant
Yarr parse. This removes roughly 45% of the checkSyntax calls in
web-tooling-benchmark, where parser libraries like acorn and babylon
carry large Unicode identifier character classes.

This is inspired by a similar V8 change: 
https://chromium-review.googlesource.com/c/v8/v8/+/7665887

* Source/JavaScriptCore/parser/ASTBuilder.h:
(JSC::ASTBuilder::createRegExp):
* Source/JavaScriptCore/parser/Parser.cpp:
(JSC::Parser<LexerType>::parsePrimaryExpression):
* Source/JavaScriptCore/parser/SyntaxChecker.h:
(JSC::SyntaxChecker::createRegExp):

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



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

Reply via email to