From 1bd5b245b8a55353e60a2decad507ef8014be044 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Tue, 5 Sep 2023 16:52:57 -0800 Subject: Align `process.nextTick` execution order with Node (#4409) * Align `process.nextTick` execution order with Node * some tests * formatting * fixups * fix the test failures * simplify the logic here * push it up --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: dave caruso --- src/bun.js/bindings/JSNextTickQueue.h | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/bun.js/bindings/JSNextTickQueue.h (limited to 'src/bun.js/bindings/JSNextTickQueue.h') diff --git a/src/bun.js/bindings/JSNextTickQueue.h b/src/bun.js/bindings/JSNextTickQueue.h new file mode 100644 index 000000000..c3bd228cc --- /dev/null +++ b/src/bun.js/bindings/JSNextTickQueue.h @@ -0,0 +1,41 @@ +#include "root.h" +#include "headers-handwritten.h" + +#include "JavaScriptCore/JSCInlines.h" +#include "BunClientData.h" +#include + +namespace Bun { +using namespace JSC; + +class JSNextTickQueue : public JSC::JSInternalFieldObjectImpl<3> { +public: + static constexpr unsigned numberOfInternalFields = 3; + using Base = JSC::JSInternalFieldObjectImpl<3>; + + template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm); + + JS_EXPORT_PRIVATE static JSNextTickQueue* create(VM&, Structure*); + static JSNextTickQueue* create(JSC::JSGlobalObject* globalObject); + static JSNextTickQueue* createWithInitialValues(VM&, Structure*); + static Structure* createStructure(VM&, JSGlobalObject*, JSValue); + + static std::array initialValues() + { + return { { + jsNumber(-1), + jsUndefined(), + jsUndefined(), + } }; + } + + DECLARE_EXPORT_INFO; + DECLARE_VISIT_CHILDREN; + + JSNextTickQueue(JSC::VM&, JSC::Structure*); + void finishCreation(JSC::VM&); + + bool isEmpty(); + void drain(JSC::VM& vm, JSC::JSGlobalObject* globalObject); +}; +} \ No newline at end of file -- cgit v1.2.3 on> Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
AgeCommit message (Expand)AuthorFilesLines
2022-02-22Make format consistent with WebKitGravatar Jarred Sumner 20-3596/+4110
2022-02-22import assertion testGravatar Jarred Sumner 1-0/+33
2022-02-22snaspshotsGravatar Jarred Sumner 42-94/+113