Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e36036d0ef7f2fe4f8167c519679fc7497b46696
      
https://github.com/WebKit/WebKit/commit/e36036d0ef7f2fe4f8167c519679fc7497b46696
  Author: Vassili Bykov <[email protected]>
  Date:   2026-10-10 (Sat, 10 Oct 2026)

  Changed paths:
    A JSTests/stress/parser-many-parenthesized-expressions-in-one-scope.js
    M Source/JavaScriptCore/parser/Parser.cpp
    M Source/JavaScriptCore/parser/Parser.h

  Log Message:
  -----------
  [JSC] Proactively merge back used-variable sets in Parser
https://bugs.webkit.org/show_bug.cgi?id=327006
rdar://188814992

Reviewed by Yijia Huang.

Every time a parenthesized expression begins, the parser adds a new 
used-variable set to the
list of such sets in Scope. If the expression turns out to be the parameter 
list of an arrow
function, the set is discarded. Otherwise, the set stays on the list, and each 
subsequent
parenthesized expression in the scope adds another one. These accumulated sets 
are only
merged and discarded at the end of the scope, so a scope with many 
parenthesized expressions
accumulates a large number of used-variable sets, in extreme cases exceeding 
the Vector length
limit.

This patch makes it so that as soon as a parenthesized expression ends, the 
contents of its
used-variable set are merged back into the set before it, and the set is 
discarded. The names
recorded for the scope are unchanged, but the number of sets is now bounded by 
the nesting
depth of parenthesized expressions in the scope.

Test: JSTests/stress/parser-many-parenthesized-expressions-in-one-scope.js
Canonical link: https://commits.webkit.org/323334@main



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

Reply via email to