1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 05:27:14 +09:00

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
parent bbef0e8375
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

@ -857,7 +857,7 @@ ALWAYS_INLINE bool PosixExtendedParser::parse_sub_expression(ByteCode& stack, si
auto current_capture_group = m_parser_state.capture_groups_count;
if (!(m_parser_state.regex_options & AllFlags::SkipSubExprResults || prevent_capture_group)) {
bytecode.insert_bytecode_group_capture_left(current_capture_group);
bytecode.insert_bytecode_group_capture_left(current_capture_group + 1);
m_parser_state.capture_groups_count++;
}
@ -888,9 +888,9 @@ ALWAYS_INLINE bool PosixExtendedParser::parse_sub_expression(ByteCode& stack, si
if (!(m_parser_state.regex_options & AllFlags::SkipSubExprResults || prevent_capture_group)) {
if (capture_group_name.has_value())
bytecode.insert_bytecode_group_capture_right(current_capture_group, capture_group_name.value());
bytecode.insert_bytecode_group_capture_right(current_capture_group + 1, capture_group_name.value());
else
bytecode.insert_bytecode_group_capture_right(current_capture_group);
bytecode.insert_bytecode_group_capture_right(current_capture_group + 1);
}
should_parse_repetition_symbol = true;
break;