1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 19:45:10 +00:00

LibJS: Remove almost all uses of Op::Jump::set_targets()

We should initialize jump targets when constructing the jump instruction
instead of doing it later. This was already the case in all construction
sites but one. This first patch converts all those sites to pass final
targets to the constructor directly.
This commit is contained in:
Andreas Kling 2023-09-28 12:43:11 +02:00
parent 84850700a0
commit bdd21cf9db
3 changed files with 67 additions and 98 deletions

View file

@ -394,13 +394,13 @@ void Generator::generate_scoped_jump(JumpType type)
switch (boundary) {
case Break:
if (type == JumpType::Break) {
emit<Op::Jump>().set_targets(nearest_breakable_scope(), {});
emit<Op::Jump>(nearest_breakable_scope());
return;
}
break;
case Continue:
if (type == JumpType::Continue) {
emit<Op::Jump>().set_targets(nearest_continuable_scope(), {});
emit<Op::Jump>(nearest_continuable_scope());
return;
}
break;
@ -455,7 +455,7 @@ void Generator::generate_labelled_jump(JumpType type, DeprecatedFlyString const&
}
if (jumpable_scope.language_label_set.contains_slow(label)) {
emit<Op::Jump>().set_targets(jumpable_scope.bytecode_target, {});
emit<Op::Jump>(jumpable_scope.bytecode_target);
return;
}
}