mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01: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
|
|
@ -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…
Reference in New Issue
Block a user