mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 09:17:36 +00:00
LibJS: Remove last user of Op::Jump::set_targets() and API itself
This was just a matter of instantiating a BasicBlock earlier so we can reference it when making the jump.
This commit is contained in:
parent
bdd21cf9db
commit
887183cad6
2 changed files with 2 additions and 14 deletions
|
@ -2048,24 +2048,21 @@ Bytecode::CodeGenerationErrorOr<void> IfStatement::generate_bytecode(Bytecode::G
|
||||||
|
|
||||||
auto& true_block = generator.make_block();
|
auto& true_block = generator.make_block();
|
||||||
auto& false_block = generator.make_block();
|
auto& false_block = generator.make_block();
|
||||||
|
auto& end_block = generator.make_block();
|
||||||
|
|
||||||
TRY(m_predicate->generate_bytecode(generator));
|
TRY(m_predicate->generate_bytecode(generator));
|
||||||
generator.emit<Bytecode::Op::JumpConditional>(
|
generator.emit<Bytecode::Op::JumpConditional>(
|
||||||
Bytecode::Label { true_block },
|
Bytecode::Label { true_block },
|
||||||
Bytecode::Label { false_block });
|
Bytecode::Label { false_block });
|
||||||
|
|
||||||
Bytecode::Op::Jump* true_block_jump { nullptr };
|
|
||||||
|
|
||||||
generator.switch_to_basic_block(true_block);
|
generator.switch_to_basic_block(true_block);
|
||||||
generator.emit<Bytecode::Op::LoadImmediate>(js_undefined());
|
generator.emit<Bytecode::Op::LoadImmediate>(js_undefined());
|
||||||
TRY(m_consequent->generate_bytecode(generator));
|
TRY(m_consequent->generate_bytecode(generator));
|
||||||
if (!generator.is_current_block_terminated()) {
|
if (!generator.is_current_block_terminated()) {
|
||||||
// FIXME: This should be initialized to the right target right away.
|
generator.emit<Bytecode::Op::Jump>(Bytecode::Label { end_block });
|
||||||
true_block_jump = &generator.emit<Bytecode::Op::Jump>(Bytecode::Label { true_block });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
generator.switch_to_basic_block(false_block);
|
generator.switch_to_basic_block(false_block);
|
||||||
auto& end_block = generator.make_block();
|
|
||||||
|
|
||||||
generator.emit<Bytecode::Op::LoadImmediate>(js_undefined());
|
generator.emit<Bytecode::Op::LoadImmediate>(js_undefined());
|
||||||
if (m_alternate)
|
if (m_alternate)
|
||||||
|
@ -2073,9 +2070,6 @@ Bytecode::CodeGenerationErrorOr<void> IfStatement::generate_bytecode(Bytecode::G
|
||||||
if (!generator.is_current_block_terminated())
|
if (!generator.is_current_block_terminated())
|
||||||
generator.emit<Bytecode::Op::Jump>(Bytecode::Label { end_block });
|
generator.emit<Bytecode::Op::Jump>(Bytecode::Label { end_block });
|
||||||
|
|
||||||
if (true_block_jump)
|
|
||||||
true_block_jump->set_targets(Bytecode::Label { end_block }, {});
|
|
||||||
|
|
||||||
generator.switch_to_basic_block(end_block);
|
generator.switch_to_basic_block(end_block);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -830,12 +830,6 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_targets(Label true_target, Optional<Label> false_target)
|
|
||||||
{
|
|
||||||
m_true_target = move(true_target);
|
|
||||||
m_false_target = move(false_target);
|
|
||||||
}
|
|
||||||
|
|
||||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue