LibRegex: Flatten capture group list in MatchState

This makes copying the capture group COWVector significantly cheaper,
as we no longer have to run any constructors for it - just memcpy.
This commit is contained in:
Ali Mohammad Pur 2025-04-15 15:31:08 +02:00 committed by Andreas Kling
commit 76f5dce3db
Notes: github-actions[bot] 2025-04-18 15:10:37 +00:00
14 changed files with 98 additions and 87 deletions

View file

@ -35,7 +35,6 @@ public:
static constexpr regex::RegexOptions<ECMAScriptFlags> default_flags {
(regex::ECMAScriptFlags)regex::AllFlags::SingleMatch
| (regex::ECMAScriptFlags)regex::AllFlags::Global
| (regex::ECMAScriptFlags)regex::AllFlags::SkipTrimEmptyMatches
| regex::ECMAScriptFlags::BrowserExtended
};

View file

@ -294,7 +294,7 @@ static ThrowCompletionOr<Value> regexp_builtin_exec(VM& vm, RegExpObject& regexp
// 33. For each integer i such that i ≥ 1 and i ≤ n, in ascending order, do
for (size_t i = 1; i <= result.n_capture_groups; ++i) {
// a. Let captureI be ith element of r's captures List.
auto& capture = result.capture_group_matches[0][i];
auto& capture = result.capture_group_matches[0][i - 1];
Value captured_value;