mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 11:09:18 +00:00
LibWasm: Make BytecodeInterpreter overrides final
This gives us free devirtualization of some hot calls inside the bytecode interpreter. Most notably the did_trap() checks. Modest performance improvement on the https://figma.com/ landing page.
This commit is contained in:
parent
e6a668ad91
commit
2f3128333d
Notes:
github-actions[bot]
2024-08-20 10:02:41 +00:00
Author: https://github.com/awesomekling
Commit: 2f3128333d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1131
Reviewed-by: https://github.com/alimpfard ✅
1 changed files with 4 additions and 4 deletions
|
@ -18,18 +18,18 @@ struct BytecodeInterpreter : public Interpreter {
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void interpret(Configuration&) override;
|
virtual void interpret(Configuration&) final;
|
||||||
|
|
||||||
virtual ~BytecodeInterpreter() override = default;
|
virtual ~BytecodeInterpreter() override = default;
|
||||||
virtual bool did_trap() const override { return !m_trap.has<Empty>(); }
|
virtual bool did_trap() const final { return !m_trap.has<Empty>(); }
|
||||||
virtual ByteString trap_reason() const override
|
virtual ByteString trap_reason() const final
|
||||||
{
|
{
|
||||||
return m_trap.visit(
|
return m_trap.visit(
|
||||||
[](Empty) -> ByteString { VERIFY_NOT_REACHED(); },
|
[](Empty) -> ByteString { VERIFY_NOT_REACHED(); },
|
||||||
[](Trap const& trap) { return trap.reason; },
|
[](Trap const& trap) { return trap.reason; },
|
||||||
[](JS::Completion const& completion) { return completion.value()->to_string_without_side_effects().to_byte_string(); });
|
[](JS::Completion const& completion) { return completion.value()->to_string_without_side_effects().to_byte_string(); });
|
||||||
}
|
}
|
||||||
virtual void clear_trap() override { m_trap = Empty {}; }
|
virtual void clear_trap() final { m_trap = Empty {}; }
|
||||||
|
|
||||||
struct CallFrameHandle {
|
struct CallFrameHandle {
|
||||||
explicit CallFrameHandle(BytecodeInterpreter& interpreter, Configuration& configuration)
|
explicit CallFrameHandle(BytecodeInterpreter& interpreter, Configuration& configuration)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue