Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions src/install/lockfile/Buffers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,6 @@ where
let mut clone: Vec<$elem> = Vec::with_capacity(buffers.$field.len());
clone.extend_from_slice(buffers.$field.as_slice());
write_array(stream, clone.as_slice(), $prefix)?;
#[cfg(debug_assertions)]
{
// Output::pretty_errorln(format_args!("Field {}: {} - {}", $name, pos, stream.get_pos()?));
}
}};
}

Expand All @@ -264,10 +260,6 @@ where
// reader ignores this string; only the exact bytes matter.
"\n<install.lockfile.Tree> 20 sizeof, 4 alignof\n",
)?;
#[cfg(debug_assertions)]
{
// Output::pretty_errorln(format_args!("Field {}: {} - {}", "trees", pos, stream.get_pos()?));
}
}

// -- hoisted_dependencies --
Expand Down Expand Up @@ -349,11 +341,6 @@ where
to_clone.as_slice(),
"\n<[26]u8> 26 sizeof, 1 alignof\n",
)?;

#[cfg(debug_assertions)]
{
// Output::pretty_errorln(format_args!("Field {}: {} - {}", "dependencies", pos, stream.get_pos()?));
}
}

// -- extern_strings --
Expand Down Expand Up @@ -427,8 +414,6 @@ pub(crate) fn load(
bun_core::pretty_errorln!("Loaded {} {}", this.$field.len(), $name);
}
}
// #[cfg(debug_assertions)]
// Output::pretty_errorln(format_args!("Field {}: {} - {}", $name, _pos, stream.get_pos()?));
}};
}

Comment thread
robobun marked this conversation as resolved.
Expand Down
4 changes: 0 additions & 4 deletions src/install/lockfile/bun.lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,6 @@ pub(crate) struct Stringifier;
impl Stringifier {
const INDENT_SCALAR: usize = 2;

// pub fn save(this: &Lockfile) {
// let _ = this;
// }

pub(crate) fn save_from_binary(
lockfile: &mut BinaryLockfile,
load_result: &LoadResult,
Expand Down
30 changes: 0 additions & 30 deletions src/io/windows_event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,38 +153,8 @@
}
self.flags.remove(Flags::Closed);

vm.loop_add_active(self.flags.contains(Flags::HasIncrementedPollCount) as u32);
}

Check warning on line 157 in src/io/windows_event_loop.rs

View check run for this annotation

Claude / Claude Code Review

FilePoll::ref_/activate removal left three orphans

Removing `FilePoll::ref_`/`activate`/`can_ref` left three orphans behind: (1) `declare_scope!(FilePoll, visible)` at line 16 — the two removed methods held the only `scoped_log!(FilePoll, ...)` calls in the tree; (2) the doc comment "/// Make calling ref() on this poll into a no-op." on `disable_keeping_process_alive` (~line 60) now names a method that no longer exists on Windows `FilePoll`; (3) `posix_event_loop::FilePoll::ref_` (posix_event_loop.rs:562-568) — the PR's own justification ("No ca
Comment thread
robobun marked this conversation as resolved.

/// Only intended to be used from EventLoop.Pollable
pub fn activate(&mut self, loop_: &mut WindowsLoop) {
loop_.add_active(
(!self.flags.contains(Flags::Closed)
&& !self.flags.contains(Flags::HasIncrementedPollCount)) as u32,
);
bun_core::scoped_log!(FilePoll, "activate - {}", loop_.uv().active_handles);
self.flags.insert(Flags::HasIncrementedPollCount);
}

#[inline]
pub fn can_ref(&self) -> bool {
if self.flags.contains(Flags::Closed) {
return false;
}

!self.flags.contains(Flags::HasIncrementedPollCount)
}

/// Allow a poll to keep the process alive.
// pub fn ref(this: *FilePoll, vm: *jsc.VirtualMachine) void {
pub fn ref_(&mut self, event_loop_ctx: EventLoopCtx) {
if self.can_ref() {
return;
}
bun_core::scoped_log!(FilePoll, "ref");
// this.activate(vm.event_loop_handle.?);
self.activate(event_loop_ctx.loop_mut());
}
}

type FilePollHiveArray = bun_collections::hive_array::Fallback<FilePoll, 128>;
Expand Down
4 changes: 0 additions & 4 deletions src/js/node/net.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ const bunTlsSymbol = Symbol.for("::buntls::");
const bunSocketServerOptions = Symbol.for("::bunnetserveroptions::");
const owner_symbol = Symbol("owner_symbol");

const kServerSocket = Symbol("kServerSocket");
const kBytesWritten = Symbol("kBytesWritten");
const bunTLSConnectOptions = Symbol.for("::buntlsconnectoptions::");
// tls.Server exposes its native SecureContext constructor through this key so
Expand All @@ -141,7 +140,6 @@ const kSetKeepAliveInitialDelay = Symbol("kSetKeepAliveInitialDelay");
const kConnectOptions = Symbol("connect-options");
const kAttach = Symbol("kAttach");
const kCloseRawConnection = Symbol("kCloseRawConnection");
const kpendingRead = Symbol("kpendingRead");
const kupgraded = Symbol("kupgraded");
const kAdoptedTLSRaw = Symbol("kAdoptedTLSRaw");
const ksocket = Symbol("ksocket");
Expand Down Expand Up @@ -1125,7 +1123,6 @@ function onconnection(err, clientHandle) {
self.emit("error", err);
return;
}
clientHandle[kServerSocket] = handle;
const options = self[bunSocketServerOptions];
const { pauseOnConnect, connectionListener, [kSocketClass]: SClass } = options;
// Propagate the server's half-open/highWaterMark settings to the accepted
Expand Down Expand Up @@ -1556,7 +1553,6 @@ function Socket(options?) {
});
this._parent = null;
this._parentWrap = null;
this[kpendingRead] = undefined;
this[kupgraded] = null;

this[kSetNoDelay] = Boolean(noDelay);
Expand Down
3 changes: 0 additions & 3 deletions src/jsc/bindings/Bindgen/IDLTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ struct IDLStrongAny : WebCore::IDLType<Bun::StrongRef> {
}
};

template<typename T>
struct IsIDLStrongAny : std::integral_constant<bool, std::is_base_of<IDLStrongAny, T>::value> {};

// Dictionaries that contain raw `JSValue`s must live on the stack.
template<typename T>
struct IDLStackOnlyDictionary : WebCore::IDLType<T> {
Expand Down
9 changes: 0 additions & 9 deletions src/jsc/bindings/BunClientData.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ class JSVMClientData : public JSC::VM::ClientData {

ExtendedDOMClientIsoSubspaces& clientSubspaces() { return *m_clientSubspaces.get(); }

Vector<JSC::IsoSubspace*>& outputConstraintSpaces() { return m_outputConstraintSpaces; }

JSC::GCClient::IsoSubspace& domBuiltinConstructorSpace() { return m_domBuiltinConstructorSpace; }

// Constructed eagerly so the concurrent GC marker
Expand All @@ -120,12 +118,6 @@ class JSVMClientData : public JSC::VM::ClientData {
// so there is no startup cost worth deferring.
WebCore::HTTPHeaderIdentifiers& httpHeaderIdentifiers() { return m_httpHeaderIdentifiers; }

template<typename Func> void forEachOutputConstraintSpace(const Func& func)
{
for (auto* space : m_outputConstraintSpaces)
func(*space);
}

void* bunVM;
Bun::JSCTaskScheduler deferredWorkTimer;

Expand Down Expand Up @@ -178,7 +170,6 @@ class JSVMClientData : public JSC::VM::ClientData {
JSC::GCClient::IsoSubspace m_domNamespaceObjectSpace;

std::unique_ptr<ExtendedDOMClientIsoSubspaces> m_clientSubspaces;
Vector<JSC::IsoSubspace*> m_outputConstraintSpaces;

WebCore::HTTPHeaderIdentifiers m_httpHeaderIdentifiers;
};
Expand Down
2 changes: 1 addition & 1 deletion src/jsc/bindings/DeleteCallbackDataTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class DeleteCallbackDataTask : public EventLoopTask {
public:
template<typename CallbackDataType>
explicit DeleteCallbackDataTask(CallbackDataType* data)
: EventLoopTask(EventLoopTask::CleanupTask, [data](ScriptExecutionContext&) mutable {
: EventLoopTask([data](ScriptExecutionContext&) mutable {
delete data;
})
{
Expand Down
13 changes: 0 additions & 13 deletions src/jsc/bindings/EventLoopTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,14 @@ class EventLoopTask {
WTF_MAKE_TZONE_ALLOCATED(EventLoopTask);

public:
enum CleanupTaskTag { CleanupTask };

template<typename T, typename = typename std::enable_if<!std::is_base_of<EventLoopTask, T>::value && std::is_convertible<T, Function<void(ScriptExecutionContext&)>>::value>::type>
EventLoopTask(T task)
: m_task(WTF::move(task))
, m_isCleanupTask(false)
{
}

EventLoopTask(Function<void()>&& task)
: m_task([task = WTF::move(task)](ScriptExecutionContext&) { task(); })
, m_isCleanupTask(false)
{
}

template<typename T, typename = typename std::enable_if<std::is_convertible<T, Function<void(ScriptExecutionContext&)>>::value>::type>
EventLoopTask(CleanupTaskTag, T task)
: m_task(WTF::move(task))
, m_isCleanupTask(true)
{
}

Expand All @@ -34,11 +23,9 @@ class EventLoopTask {
m_task(context);
delete this;
}
bool isCleanupTask() const { return m_isCleanupTask; }

protected:
Function<void(ScriptExecutionContext&)> m_task;
bool m_isCleanupTask;
};

}
24 changes: 0 additions & 24 deletions src/jsc/bindings/JSBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2391,30 +2391,6 @@ static JSC::EncodedJSValue jsBufferPrototypeFunction_SliceWithEncoding(JSC::JSGl
return jsBufferToString(lexicalGlobalObject, scope, castedThis, start, end - start, encoding);
}

// DOMJIT makes it slower! TODO: investigate why
// JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(jsBufferPrototypeToStringWithoutTypeChecks, JSValue, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::JSUint8Array* thisValue, JSC::JSString* encodingValue));

// JSC_DEFINE_JIT_OPERATION(jsBufferPrototypeToStringWithoutTypeChecks, JSValue, (JSC::JSGlobalObject * lexicalGlobalObject, JSUint8Array* thisValue, JSString* encodingValue))
// {
// auto& vm = JSC::getVM(lexicalGlobalObject);
// IGNORE_WARNINGS_BEGIN("frame-address")
// CallFrame* callFrame = DECLARE_CALL_FRAME(vm);
// IGNORE_WARNINGS_END
// JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame);

// std::optional<BufferEncodingType> encoded = parseEnumeration<BufferEncodingType>(*lexicalGlobalObject, encodingValue);
// if (!encoded) {
// auto scope = DECLARE_THROW_SCOPE(vm);

// throwTypeError(lexicalGlobalObject, scope, "Invalid encoding"_s);
// return {};
// }

// auto encoding = encoded.value();

// return JSValue::decode(jsBufferToString(vm, lexicalGlobalObject, thisValue, 0, thisValue->byteLength(), encoding));
// }

// https://github.com/nodejs/node/blob/v26.3.0/lib/internal/buffer.js#L962-L990
// Only utf8Write/latin1Write/asciiWrite go through this strict JS wrapper in node;
// the other encodings use jsBufferPrototypeFunction_StringWriteWithEncoding below.
Expand Down
4 changes: 0 additions & 4 deletions src/jsc/bindings/JSBufferList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,6 @@ JSC::EncodedJSValue JSBufferListConstructor::construct(JSC::JSGlobalObject* lexi
return JSC::JSValue::encode(bufferList);
}

void JSBufferListConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSBufferListPrototype* prototype)
{
}

const ClassInfo JSBufferListConstructor::s_info = { "BufferList"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBufferListConstructor) };

} // namespace Zig
3 changes: 0 additions & 3 deletions src/jsc/bindings/JSBufferList.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class JSBufferList : public JSC::JSNonFinalObject {
}

void finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject);
static void destroy(JSCell*) {}

inline size_t length() { return m_deque.size(); }
void push(JSC::VM& vm, JSC::JSValue v)
Expand Down Expand Up @@ -153,8 +152,6 @@ class JSBufferListConstructor final : public JSC::InternalFunction {
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;
Expand Down
25 changes: 2 additions & 23 deletions src/jsc/bindings/JSEnvironmentVariableMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,6 @@ JSC_DEFINE_CUSTOM_GETTER(jsGetterEnvironmentVariable, (JSGlobalObject * globalOb
return JSValue::encode(result);
}

JSC_DEFINE_CUSTOM_SETTER(jsSetterEnvironmentVariable, (JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue value, PropertyName propertyName))
{
VM& vm = globalObject->vm();
JSC::JSObject* object = JSValue::decode(thisValue).getObject();
if (!object)
return false;

auto string = JSValue::decode(value).toString(globalObject);
if (!string) [[unlikely]]
return false;

object->putDirect(vm, propertyName, string, 0);
return true;
}

// Proxy-related env vars (HTTP_PROXY, HTTPS_PROXY, NO_PROXY and lowercase
// variants) are read by fetch()'s native proxy resolution via
// env_loader.getHttpProxyFor(). Writes from JS must sync back to the native env
Expand Down Expand Up @@ -118,14 +103,8 @@ JSC_DEFINE_CUSTOM_SETTER(jsSetterProxyEnvironmentVariable, (JSGlobalObject * glo
BunString val = Bun::toStringView(view);
Bun__setEnvValue(globalObject, &name, &val);

// The proxy-var accessors are added with `DontEnum` when the var was not
// present in the OS env at startup. The regular env-var setter
// (`jsSetterEnvironmentVariable`) makes a written var enumerable by
// replacing the accessor with a data property; this setter keeps the
// accessor (so the native env map stays the source of truth) but must
// still clear `DontEnum` — otherwise `process.env.HTTP_PROXY = "..."`
// followed by `Bun.spawn({env: {...process.env}})` silently drops the var
// (the spread skips non-enumerable properties).
// Proxy-var accessors are installed DontEnum when absent from the OS env
// at startup; clear it on write so `{...process.env}` picks the var up.
Comment thread
robobun marked this conversation as resolved.
unsigned attributes;
JSValue existing = object->getDirect(vm, propertyName, attributes);
if (existing && (attributes & JSC::PropertyAttribute::DontEnum)) {
Expand Down
9 changes: 0 additions & 9 deletions src/jsc/bindings/JSNextTickQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@ class JSNextTickQueue : public JSC::JSInternalFieldObjectImpl<3> {
static JSNextTickQueue* create(JSC::JSGlobalObject* globalObject);
static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
Comment thread
robobun marked this conversation as resolved.

static std::array<JSValue, numberOfInternalFields> initialValues()
{
return { {
jsNumber(-1),
jsUndefined(),
jsUndefined(),
} };
}

DECLARE_EXPORT_INFO;
DECLARE_VISIT_CHILDREN;

Expand Down
9 changes: 0 additions & 9 deletions src/jsc/bindings/JSStringDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,15 +605,6 @@ JSC::EncodedJSValue JSStringDecoderConstructor::construct(JSC::JSGlobalObject* l
return JSC::JSValue::encode(jsObject);
}

void JSStringDecoderConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSStringDecoderPrototype* prototype)
{
putDirect(vm, vm.propertyNames->length, jsNumber(1), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
JSString* nameString = jsNontrivialString(vm, "StringDecoder"_s);
m_originalName.set(vm, this, nameString);
putDirect(vm, vm.propertyNames->name, nameString, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
putDirect(vm, vm.propertyNames->prototype, prototype, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::DontDelete);
}

const ClassInfo JSStringDecoderConstructor::s_info = { "StringDecoder"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSStringDecoderConstructor) };

} // namespace Zig
2 changes: 0 additions & 2 deletions src/jsc/bindings/JSStringDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ class JSStringDecoderConstructor final : public JSC::InternalFunction {
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info());
}

void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSStringDecoderPrototype* prototype);

// Must be defined for each specialization class.
static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*);
DECLARE_EXPORT_INFO;
Expand Down
5 changes: 0 additions & 5 deletions src/jsc/bindings/NodeVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1111,11 +1111,6 @@ void NodeVMGlobalObject::setContextifiedObject(JSC::JSObject* contextifiedObject
m_sandbox.set(vm(), this, contextifiedObject);
}

void NodeVMGlobalObject::clearContextifiedObject()
{
m_sandbox.clear();
}

void NodeVMGlobalObject::sigintReceived()
{
vm().notifyNeedTermination();
Expand Down
1 change: 0 additions & 1 deletion src/jsc/bindings/NodeVM.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ class NodeVMGlobalObject final : public Bun::GlobalScope {
static void destroy(JSCell* cell);
void setContextifiedObject(JSC::JSObject* contextifiedObject);
JSObject* contextifiedObject() const { return m_sandbox.get(); }
void clearContextifiedObject();
void sigintReceived();
bool isNotContextified() const { return m_contextOptions.notContextified; }
bool hasOwnMicrotaskQueue() const { return m_contextOptions.ownMicrotaskQueue; }
Expand Down
5 changes: 0 additions & 5 deletions src/jsc/bindings/NodeVMModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ NodeVMModuleRequest::NodeVMModuleRequest(WTF::String specifier, WTF::HashMap<WTF
{
}

void NodeVMModuleRequest::addImportAttribute(WTF::String key, WTF::String value)
{
m_importAttributes.set(WTF::move(key), WTF::move(value));
}

JSArray* NodeVMModuleRequest::toJS(JSGlobalObject* globalObject) const
{
auto& vm = globalObject->vm();
Expand Down
2 changes: 0 additions & 2 deletions src/jsc/bindings/NodeVMModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ class NodeVMModuleRequest final {
NodeVMModuleRequest(WTF::String specifier, WTF::HashMap<WTF::String, WTF::String> importAttributes = {});

JSArray* toJS(JSGlobalObject* globalObject) const;
void addImportAttribute(WTF::String key, WTF::String value);

const WTF::String& specifier() const { return m_specifier; }
void specifier(WTF::String value) { m_specifier = value; }
const WTF::HashMap<WTF::String, WTF::String>& importAttributes() const { return m_importAttributes; }

private:
Expand Down
1 change: 0 additions & 1 deletion src/jsc/bindings/NodeVMScript.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class NodeVMScript final : public JSC::JSDestructibleObject, public SigintReceiv

const JSC::SourceCode& source() const { return m_source; }
WTF::Vector<uint8_t>& cachedData() { return m_options.cachedData; }
RefPtr<JSC::CachedBytecode> cachedBytecode() const { return m_cachedBytecode; }
JSC::ProgramExecutable* cachedExecutable() const { return m_cachedExecutable.get(); }
bool cachedDataProduced() const { return m_cachedDataProduced; }
void cachedDataProduced(bool value) { m_cachedDataProduced = value; }
Expand Down
Loading
Loading