mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-29 08:11:13 +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: https://github.com/LadybirdBrowser/ladybird/commit/2f3128333dc Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1131 Reviewed-by: https://github.com/alimpfard ✅
|
@ -18,18 +18,18 @@ struct BytecodeInterpreter : public Interpreter {
|
|||
{
|
||||
}
|
||||
|
||||
virtual void interpret(Configuration&) override;
|
||||
virtual void interpret(Configuration&) final;
|
||||
|
||||
virtual ~BytecodeInterpreter() override = default;
|
||||
virtual bool did_trap() const override { return !m_trap.has<Empty>(); }
|
||||
virtual ByteString trap_reason() const override
|
||||
virtual bool did_trap() const final { return !m_trap.has<Empty>(); }
|
||||
virtual ByteString trap_reason() const final
|
||||
{
|
||||
return m_trap.visit(
|
||||
[](Empty) -> ByteString { VERIFY_NOT_REACHED(); },
|
||||
[](Trap const& trap) { return trap.reason; },
|
||||
[](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 {
|
||||
explicit CallFrameHandle(BytecodeInterpreter& interpreter, Configuration& configuration)
|
||||
|
|
Loading…
Reference in a new issue