diff options
Diffstat (limited to 'src/bun.js/bindings/GCDefferalContext.h')
-rw-r--r-- | src/bun.js/bindings/GCDefferalContext.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/bun.js/bindings/GCDefferalContext.h b/src/bun.js/bindings/GCDefferalContext.h new file mode 100644 index 000000000..7bedfb3e0 --- /dev/null +++ b/src/bun.js/bindings/GCDefferalContext.h @@ -0,0 +1,21 @@ +#pragma once + +#include "helpers.h" + +namespace JSC { + +ALWAYS_INLINE GCDeferralContext::GCDeferralContext(VM& vm) + : m_vm(vm) +{ +} + +ALWAYS_INLINE GCDeferralContext::~GCDeferralContext() +{ + if constexpr (validateDFGDoesGC) + m_vm.verifyCanGC(); + + if (UNLIKELY(m_shouldGC)) + m_vm.heap.collectIfNecessaryOrDefer(); +} + +} // namespace JSC
\ No newline at end of file |