mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
LibRegex: Avoid generating ForkJumps when jumping to the next alt block
Fixes #2398.
This commit is contained in:
committed by
Ali Mohammad Pur
parent
b264d18ad1
commit
5a4d657a4e
Notes:
github-actions[bot]
2024-11-17 19:13:35 +00:00
Author: https://github.com/alimpfard Commit: https://github.com/LadybirdBrowser/ladybird/commit/5a4d657a4e8 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2401
@@ -1197,6 +1197,8 @@ void Optimizer::append_alternation(ByteCode& target, Span<ByteCode> alternatives
|
||||
for (auto& patch : patch_locations) {
|
||||
if (!patch.done && node_is(node, patch.source_ip)) {
|
||||
auto value = static_cast<ByteCodeValueType>(target.size() - patch.target_ip - 1);
|
||||
if (value == 0)
|
||||
target[patch.target_ip - 1] = static_cast<ByteCodeValueType>(OpCodeId::Jump);
|
||||
target[patch.target_ip] = value;
|
||||
patch.done = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user