Skip to content

Commit e540e11

Browse files
pthierv8-scoped@luci-project-accounts.iam.gserviceaccount.com
authored andcommitted
[regexp] Fix modifiers for ChoiceNodes during Analysis
During the analysis pass we didn't reset flags after visiting alternatives of a ChoiceNode, which is required as the sub-graph of an alternative might modify the flags. Fixed: 510487690 Change-Id: I6b2660a98b34cd12740538af4ce61685609934a0 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7826630 Commit-Queue: Patrick Thier <[email protected]> Auto-Submit: Patrick Thier <[email protected]> Reviewed-by: Jakob Linke <[email protected]> Commit-Queue: Jakob Linke <[email protected]> Cr-Commit-Position: refs/heads/main@{#107120}
1 parent 205b157 commit e540e11

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎src/regexp/regexp-compiler.cc‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3863,8 +3863,13 @@ class Analysis : public NodeVisitor {
38633863
}
38643864

38653865
void VisitChoice(ChoiceNode* that) override {
3866+
// Flags need to be reset to the state of the ChoiceNode at the beginning
3867+
// of each alternative, as flags might be modified when visiting an
3868+
// alternative.
3869+
Flags header_flags = flags();
38663870
for (int i = 0; i < that->alternatives()->length(); i++) {
38673871
EnsureAnalyzed(that->alternatives()->at(i).node());
3872+
set_flags(header_flags);
38683873
if (has_failed()) return;
38693874
STATIC_FOR_EACH(Propagators::VisitChoice(that, i));
38703875
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Copyright 2026 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
assertTrue(/(?i:x|[a-f])/.test("F"));

0 commit comments

Comments
 (0)