diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-16 19:18:46 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-16 19:18:46 +0100 |
commit | cb2e7d1c5f702cd80171ace1b201f382aa69f9d5 (patch) | |
tree | fcc493db644c2c045667087ec5816de84fb44626 /Libraries/LibJS/Heap/Heap.h | |
parent | ab404a2f8861a30ccc8e200ca06399b23add453c (diff) | |
download | serenity-cb2e7d1c5f702cd80171ace1b201f382aa69f9d5.zip |
LibJS+js: Add a debug option (js -g) to GC after every allocation
This is very useful for discovering collector bugs.
Diffstat (limited to 'Libraries/LibJS/Heap/Heap.h')
-rw-r--r-- | Libraries/LibJS/Heap/Heap.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Libraries/LibJS/Heap/Heap.h b/Libraries/LibJS/Heap/Heap.h index 691c362f35..53e85fe8a5 100644 --- a/Libraries/LibJS/Heap/Heap.h +++ b/Libraries/LibJS/Heap/Heap.h @@ -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; }; |