mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWasm: Avoid frequent re/deallocations while validating expressions
Freeing and reallocating these vectors was ~6% of runtime when validating some web-based game.
This commit is contained in:
parent
80e5356853
commit
c0223befe1
Notes:
github-actions[bot]
2025-10-01 21:49:03 +00:00
Author: https://github.com/alimpfard
Commit: c0223befe1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6140
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/R-Goc
2 changed files with 9 additions and 7 deletions
|
|
@ -622,7 +622,7 @@ public:
|
|||
|
||||
private:
|
||||
ModuleInstance const& m_module;
|
||||
Vector<Value> m_locals;
|
||||
Vector<Value, 8> m_locals;
|
||||
Expression const& m_expression;
|
||||
size_t m_arity { 0 };
|
||||
size_t m_label_index { 0 };
|
||||
|
|
|
|||
|
|
@ -206,7 +206,9 @@ public:
|
|||
friend struct AK::Formatter;
|
||||
|
||||
public:
|
||||
explicit Stack(Vector<Frame> const& frames)
|
||||
explicit Stack(Vector<Frame, 16>&&) = delete;
|
||||
|
||||
explicit Stack(Vector<Frame, 16> const& frames)
|
||||
: m_frames(frames)
|
||||
{
|
||||
}
|
||||
|
|
@ -261,17 +263,17 @@ public:
|
|||
return {};
|
||||
}
|
||||
|
||||
Vector<StackEntry> release_vector()
|
||||
Vector<StackEntry, 8> release_vector()
|
||||
{
|
||||
m_max_known_size = 0;
|
||||
return exchange(m_entries, Vector<StackEntry> {});
|
||||
return exchange(m_entries, {});
|
||||
}
|
||||
|
||||
size_t max_known_size() const { return m_max_known_size; }
|
||||
|
||||
private:
|
||||
Vector<StackEntry> m_entries;
|
||||
Vector<Frame> const& m_frames;
|
||||
Vector<StackEntry, 8> m_entries;
|
||||
Vector<Frame, 16> const& m_frames;
|
||||
size_t m_max_known_size { 0 };
|
||||
};
|
||||
|
||||
|
|
@ -360,7 +362,7 @@ private:
|
|||
};
|
||||
|
||||
Context m_context;
|
||||
Vector<Frame> m_frames;
|
||||
Vector<Frame, 16> m_frames;
|
||||
size_t m_max_frame_size { 0 };
|
||||
COWVector<GlobalType> m_globals_without_internal_globals;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue