LibJS+js: Add a debug option (js -g) to GC after every allocation

This is very useful for discovering collector bugs.
This commit is contained in:
Andreas Kling 2020-03-16 19:18:46 +01:00
commit cb2e7d1c5f
Notes: sideshowbarker 2024-07-19 08:16:27 +09:00
3 changed files with 11 additions and 0 deletions

View file

@ -55,6 +55,9 @@ public:
Interpreter& interpreter() { return m_interpreter; }
bool should_collect_on_every_allocation() const { return m_should_collect_on_every_allocation; }
void set_should_collect_on_every_allocation(bool b) { m_should_collect_on_every_allocation = b; }
private:
Cell* allocate_cell(size_t);
@ -65,6 +68,8 @@ private:
Cell* cell_from_possible_pointer(FlatPtr);
bool m_should_collect_on_every_allocation { false };
Interpreter& m_interpreter;
Vector<NonnullOwnPtr<HeapBlock>> m_blocks;
};