diff options
Diffstat (limited to 'src/bun.js/bindings/JSSink.cpp')
-rw-r--r-- | src/bun.js/bindings/JSSink.cpp | 64 |
1 files changed, 40 insertions, 24 deletions
diff --git a/src/bun.js/bindings/JSSink.cpp b/src/bun.js/bindings/JSSink.cpp index d986ae590..ef6343849 100644 --- a/src/bun.js/bindings/JSSink.cpp +++ b/src/bun.js/bindings/JSSink.cpp @@ -711,6 +711,7 @@ public: template<typename CellType, JSC::SubspaceAccess> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) { + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSArrayBufferSinkPrototype, Base); return &vm.plainObjectSpace(); } static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) @@ -743,6 +744,7 @@ public: template<typename CellType, JSC::SubspaceAccess> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) { + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableArrayBufferSinkControllerPrototype, Base); return &vm.plainObjectSpace(); } static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) @@ -798,17 +800,19 @@ void JSReadableArrayBufferSinkController::detach() auto readableStream = m_weakReadableStream.get(); auto onClose = m_onClose.get(); - m_onClose.clear(); if (readableStream && onClose) { - JSC::JSGlobalObject* globalObject = this->globalObject(); auto callData = JSC::getCallData(onClose); - JSC::MarkedArgumentBuffer arguments; - arguments.append(readableStream); - arguments.append(jsUndefined()); - call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); + if (callData.type != JSC::CallData::Type::None) { + JSC::JSGlobalObject* globalObject = this->globalObject(); + JSC::MarkedArgumentBuffer arguments; + arguments.append(readableStream); + arguments.append(jsUndefined()); + call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); + } } + m_onClose.clear(); m_weakReadableStream.clear(); } @@ -965,6 +969,7 @@ public: template<typename CellType, JSC::SubspaceAccess> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) { + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSFileSinkPrototype, Base); return &vm.plainObjectSpace(); } static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) @@ -997,6 +1002,7 @@ public: template<typename CellType, JSC::SubspaceAccess> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) { + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableFileSinkControllerPrototype, Base); return &vm.plainObjectSpace(); } static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) @@ -1052,17 +1058,19 @@ void JSReadableFileSinkController::detach() auto readableStream = m_weakReadableStream.get(); auto onClose = m_onClose.get(); - m_onClose.clear(); if (readableStream && onClose) { - JSC::JSGlobalObject* globalObject = this->globalObject(); auto callData = JSC::getCallData(onClose); - JSC::MarkedArgumentBuffer arguments; - arguments.append(readableStream); - arguments.append(jsUndefined()); - call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); + if (callData.type != JSC::CallData::Type::None) { + JSC::JSGlobalObject* globalObject = this->globalObject(); + JSC::MarkedArgumentBuffer arguments; + arguments.append(readableStream); + arguments.append(jsUndefined()); + call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); + } } + m_onClose.clear(); m_weakReadableStream.clear(); } @@ -1219,6 +1227,7 @@ public: template<typename CellType, JSC::SubspaceAccess> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) { + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSHTTPResponseSinkPrototype, Base); return &vm.plainObjectSpace(); } static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) @@ -1251,6 +1260,7 @@ public: template<typename CellType, JSC::SubspaceAccess> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) { + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableHTTPResponseSinkControllerPrototype, Base); return &vm.plainObjectSpace(); } static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) @@ -1306,17 +1316,19 @@ void JSReadableHTTPResponseSinkController::detach() auto readableStream = m_weakReadableStream.get(); auto onClose = m_onClose.get(); - m_onClose.clear(); if (readableStream && onClose) { - JSC::JSGlobalObject* globalObject = this->globalObject(); auto callData = JSC::getCallData(onClose); - JSC::MarkedArgumentBuffer arguments; - arguments.append(readableStream); - arguments.append(jsUndefined()); - call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); + if (callData.type != JSC::CallData::Type::None) { + JSC::JSGlobalObject* globalObject = this->globalObject(); + JSC::MarkedArgumentBuffer arguments; + arguments.append(readableStream); + arguments.append(jsUndefined()); + call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); + } } + m_onClose.clear(); m_weakReadableStream.clear(); } @@ -1473,6 +1485,7 @@ public: template<typename CellType, JSC::SubspaceAccess> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) { + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSHTTPSResponseSinkPrototype, Base); return &vm.plainObjectSpace(); } static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) @@ -1505,6 +1518,7 @@ public: template<typename CellType, JSC::SubspaceAccess> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) { + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSReadableHTTPSResponseSinkControllerPrototype, Base); return &vm.plainObjectSpace(); } static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) @@ -1560,17 +1574,19 @@ void JSReadableHTTPSResponseSinkController::detach() auto readableStream = m_weakReadableStream.get(); auto onClose = m_onClose.get(); - m_onClose.clear(); if (readableStream && onClose) { - JSC::JSGlobalObject* globalObject = this->globalObject(); auto callData = JSC::getCallData(onClose); - JSC::MarkedArgumentBuffer arguments; - arguments.append(readableStream); - arguments.append(jsUndefined()); - call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); + if (callData.type != JSC::CallData::Type::None) { + JSC::JSGlobalObject* globalObject = this->globalObject(); + JSC::MarkedArgumentBuffer arguments; + arguments.append(readableStream); + arguments.append(jsUndefined()); + call(globalObject, onClose, callData, JSC::jsUndefined(), arguments); + } } + m_onClose.clear(); m_weakReadableStream.clear(); } |