summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Heap/Heap.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-16 19:18:46 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-16 19:18:46 +0100
commitcb2e7d1c5f702cd80171ace1b201f382aa69f9d5 (patch)
treefcc493db644c2c045667087ec5816de84fb44626 /Libraries/LibJS/Heap/Heap.h
parentab404a2f8861a30ccc8e200ca06399b23add453c (diff)
downloadserenity-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.h5
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;
};