#pragma once #include "root.h" #include "wtf/Deque.h" namespace WebCore { using namespace JSC; class JSBufferList : public JSC::JSNonFinalObject { using Base = JSC::JSNonFinalObject; public: JSBufferList(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure) { } DECLARE_VISIT_CHILDREN; DECLARE_INFO; static constexpr unsigned StructureFlags = Base::StructureFlags; template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) { if constexpr (mode == JSC::SubspaceAccess::Concurrently) return nullptr; return subspaceForImpl(vm); } static JSC::GCClient::IsoSubspace* subspaceForImpl(JSC::VM& vm); static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) { return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); } static JSBufferList* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) { JSBufferList* accessor = new (NotNull, JSC::allocateCell(vm)) JSBufferList(vm, structure); accessor->finishCreation(vm, globalObject); return accessor; } void finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject); static void destroy(JSCell*) {} size_t length() { return m_deque.size(); } void push(JSC::VM& vm, JSC::JSValue v) { m_deque.append(WriteBarrier()); m_deque.last().set(vm, this, v); } void unshift(JSC::VM& vm, JSC::JSValue v) { m_deque.prepend(WriteBarrier()); m_deque.first().set(vm, this, v); } JSC::JSValue shift() { if (UNLIKELY(length() == 0)) return JSC::jsUndefined(); auto v = m_deque.first().get(); m_deque.removeFirst(); return v; } void clear() { m_deque.clear(); } JSC::JSValue first() { if (UNLIKELY(length() == 0)) return JSC::jsUndefined(); return JSC::JSValue(m_deque.first().get()); } JSC::JSValue concat(JSC::VM&, JSC::JSGlobalObject*, size_t); JSC::JSValue join(JSC::VM&, JSC::JSGlobalObject*, JSString*); JSC::JSValue consume(JSC::VM&, JSC::JSGlobalObject*, size_t, bool); JSC::JSValue _getBuffer(JSC::VM&, JSC::JSGlobalObject*, size_t); JSC::JSValue _getString(JSC::VM&, JSC::JSGlobalObject*, size_t); private: Deque> m_deque; }; class JSBufferListPrototype : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; static JSBufferListPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) { JSBufferListPrototype* ptr = new (NotNull, JSC::allocateCell(vm)) JSBufferListPrototype(vm, structure); ptr->finishCreation(vm, globalObject); return ptr; } DECLARE_INFO; template static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) { return &vm.plainObjectSpace(); } static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) { return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); } private: JSBufferListPrototype(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure) { } void finishCreation(JSC::VM&, JSC::JSGlobalObject*); }; class JSBufferListConstructor final : public JSC::InternalFunction { public: using Base = JSC::InternalFunction; static JSBufferListConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSBufferListPrototype* prototype); static constexpr unsigned StructureFlags = Base::StructureFlags; static constexpr bool needsDestruction = false; static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) { return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); } void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSBufferListPrototype* prototype); // Must be defined for each specialization class. static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); DECLARE_EXPORT_INFO; private: JSBufferListConstructor(JSC::VM& vm, JSC::Structure* structure, JSC::NativeFunction nativeFunction) : Base(vm, structure, nativeFunction, nativeFunction) { } void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSBufferListPrototype* prototype); }; } n> Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
AgeCommit message (Expand)AuthorFilesLines
2022-01-29Update bun-flavored-toml.mdGravatar Jarred Sumner 1-11/+1
2022-01-29Update MakefileGravatar Jarred Sumner 1-0/+1
2022-01-29Slight tweaks to TOML parserGravatar Jarred Sumner 3-13/+134
2022-01-29Bundle embedded fast refresh if using react and no fast refresh is foundGravatar Jarred Sumner 1-9/+16
2022-01-29Embed a favicon when none existsGravatar Jarred Sumner 2-0/+30
2022-01-29cleanupGravatar Jarred Sumner 3-6/+39
2022-01-29Enable Fast Refresh when not bundlingGravatar Jarred Sumner 1-9/+34
2022-01-29Embed React Fast Refresh in BunGravatar Jarred Sumner 14-80/+327
2022-01-29Handle null/undefined `module.exports` betterGravatar Jarred Sumner 1-4/+7
2022-01-29[JS Printer] Fix CJS <> ESM interop edgecaseGravatar Jarred Sumner 1-0/+7
2022-01-29Fix bug introduced in 97d17904Gravatar Jarred Sumner 1-1/+1
2022-01-29Slice onceGravatar Jarred Sumner 1-5/+8
2022-01-29Tag importsGravatar Jarred Sumner 2-0/+26
2022-01-28Update toml_lexer.zigGravatar Jarred Sumner 1-1/+0
2022-01-28Implement TOML parserGravatar Jarred Sumner 15-18/+2044
2022-01-28Update AST layout to store capacity for itemsGravatar Jarred Sumner 49-396/+513
2022-01-28Update README.mdGravatar Jarred Sumner 1-1/+1
2022-01-28Update README.mdGravatar Jarred Sumner 1-4/+0
2022-01-28Update README.mdGravatar Jarred Sumner 1-6/+4
2022-01-28Update README.mdGravatar Jarred Sumner 1-8/+5
2022-01-28Update README.mdGravatar Jarred Sumner 1-30/+48
2022-01-28Update README.mdGravatar Jarred Sumner 1-2/+2
2022-01-28Update README.mdGravatar Jarred Sumner 1-0/+5
2022-01-28Add Bun.Transpiler doc to the readmeGravatar Jarred Sumner 1-0/+215
2022-01-27Automate clang version checking / code signing (#113)Gravatar Alexander Kuznetsov 1-2/+14
2022-01-27Stop reading `"bun"` from package.jsonGravatar Jarred Sumner 1-29/+0
2022-01-27[bunfig] Implement config file formatGravatar Jarred Sumner 20-156/+667
2022-01-27Don't look like a crash when CLI args are missingGravatar Jarred Sumner 1-0/+3
2022-01-27[cli] Add support for commands which optionally have one argumentGravatar Jarred Sumner 3-12/+22
2022-01-26Update MakefileGravatar Jarred Sumner 1-1/+1
2022-01-26print file name on panicGravatar Jarred Sumner 1-1/+1
2022-01-25mergeGravatar Jarred Sumner 2-1/+2
2022-01-25Slightly saferGravatar Jarred Sumner 1-1/+1
2022-01-25Split http into filesGravatar Jarred Sumner 7-1079/+1055
2022-01-25Update DockerfileGravatar Jarred Sumner 1-1/+1
2022-01-25Fix up dev containerGravatar Jarred Sumner 2-5/+1
2022-01-25On successful connect, switch to non-blocking sockets until we're about to closeGravatar Jarred SUmner 1-2/+18
2022-01-25Fix getsockopt()Gravatar Jarred SUmner 1-2/+5
2022-01-24Automatically retry on would blockGravatar Jarred SUmner 1-8/+4
2022-01-24Fallback to readev / writevGravatar Jarred SUmner 1-7/+226
2022-01-24No io_uring for Ubuntu 20.04Gravatar Jarred SUmner 6-27/+50
2022-01-23Update io_linux.zigGravatar Jarred Sumner 1-0/+1
2022-01-23[linux][http] return errno instead of unexpectedGravatar Jarred Sumner 1-2/+31
2022-01-23[http] Remove usages of `unreachable` in syscall error handlingGravatar Jarred Sumner 1-10/+0
2022-01-23Update io_linux.zigGravatar Jarred Sumner 1-0/+1
2022-01-23Use non-cancellable syscalls for HTTP & use errno for errorsGravatar Jarred Sumner 3-78/+933
2022-01-23Improve error message when `bun upgrade` failsGravatar Jarred Sumner 1-1/+1
2022-01-23NiceGravatar Jarred Sumner 1-1/+1
2022-01-23Update analytics_thread.zigGravatar Jarred Sumner 1-0/+8