mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 12:49:19 +00:00
LibRegex: Treat checks against nonexistent checkpoints as empty
Due to optimiser shenanigans in the tree alternative form, some JumpNonEmpty ops might be moved before their Checkpoint instruction. It is safe to assume the distance between the nonexistent checkpoint and the current op is zero, so just do that.
This commit is contained in:
parent
358378c1c0
commit
eee90f4aa2
Notes:
github-actions[bot]
2024-12-13 09:01:16 +00:00
Author: https://github.com/alimpfard
Commit: eee90f4aa2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2410
Reviewed-by: https://github.com/LucasChollet
Reviewed-by: https://github.com/konradekk
2 changed files with 3 additions and 1 deletions
|
@ -1085,7 +1085,7 @@ ALWAYS_INLINE ExecutionResult OpCode_Checkpoint::execute(MatchInput const&, Matc
|
|||
ALWAYS_INLINE ExecutionResult OpCode_JumpNonEmpty::execute(MatchInput const& input, MatchState& state) const
|
||||
{
|
||||
u64 current_position = state.string_position;
|
||||
auto checkpoint_position = state.checkpoints[checkpoint()];
|
||||
auto checkpoint_position = state.checkpoints.get(checkpoint()).value_or(0);
|
||||
|
||||
if (checkpoint_position != 0 && checkpoint_position != current_position + 1) {
|
||||
auto form = this->form();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue