diff --git a/cmake/targets/BuildBun.cmake b/cmake/targets/BuildBun.cmake index 70b020e176..62a582b79c 100644 --- a/cmake/targets/BuildBun.cmake +++ b/cmake/targets/BuildBun.cmake @@ -632,6 +632,7 @@ file(GLOB BUN_CXX_SOURCES ${CONFIGURE_DEPENDS} ${CWD}/src/bun.js/bindings/sqlite/*.cpp ${CWD}/src/bun.js/bindings/webcrypto/*.cpp ${CWD}/src/bun.js/bindings/webcrypto/*/*.cpp + ${CWD}/src/bun.js/bindings/node/*.cpp ${CWD}/src/bun.js/bindings/node/crypto/*.cpp ${CWD}/src/bun.js/bindings/v8/*.cpp ${CWD}/src/bun.js/bindings/v8/shim/*.cpp diff --git a/src/bun.js/ConsoleObject.zig b/src/bun.js/ConsoleObject.zig index fb52650076..0a180a807d 100644 --- a/src/bun.js/ConsoleObject.zig +++ b/src/bun.js/ConsoleObject.zig @@ -1502,7 +1502,7 @@ pub const Formatter = struct { } if (next_value.isNumber() or !next_value.isSymbol()) double_convert: { - var value = next_value.coerceToDouble(global); + var value = try next_value.toNumber(global); if (!std.math.isFinite(value)) { // for NaN and the string Infinity and -Infinity, parseInt returns NaN @@ -1577,7 +1577,7 @@ pub const Formatter = struct { // because spec says to convert the value to a string // and then parse as a number, but we are just coercing // a number. - break :brk next_value.coerceToDouble(global); + break :brk try next_value.toNumber(global); }; const abs = @abs(converted); diff --git a/src/bun.js/api/Timer.zig b/src/bun.js/api/Timer.zig index f1357fc5e2..9f3c312350 100644 --- a/src/bun.js/api/Timer.zig +++ b/src/bun.js/api/Timer.zig @@ -330,7 +330,7 @@ pub const All = struct { globalThis: *JSGlobalObject, callback: JSValue, arguments: JSValue, - ) callconv(.C) JSValue { + ) callconv(.c) JSValue { JSC.markBinding(@src()); const id = globalThis.bunVM().timer.last_id; globalThis.bunVM().timer.last_id +%= 1; @@ -394,23 +394,24 @@ pub const All = struct { globalThis: *JSGlobalObject, countdown: JSValue, overflow_behavior: CountdownOverflowBehavior, - ) u31 { + warn: bool, + ) JSError!u31 { // We don't deal with nesting levels directly // but we do set the minimum timeout to be 1ms for repeating timers - // TODO: this is wrong as it clears exceptions (e.g `setTimeout(()=>{}, { [Symbol.toPrimitive]() { throw 'oops'; } })`) - - const countdown_double = countdown.coerceToDouble(globalThis); + const countdown_double = try countdown.toNumber(globalThis); const countdown_int: u31 = switch (overflow_behavior) { .clamp => std.math.lossyCast(u31, countdown_double), .one_ms => if (!(countdown_double >= 1 and countdown_double <= std.math.maxInt(u31))) one: { - if (countdown_double > std.math.maxInt(u31)) { - warnInvalidCountdown(globalThis, countdown_double, .TimeoutOverflowWarning); - } else if (countdown_double < 0 and !this.warned_negative_number) { - this.warned_negative_number = true; - warnInvalidCountdown(globalThis, countdown_double, .TimeoutNegativeWarning); - } else if (!countdown.isUndefined() and countdown.isNumber() and std.math.isNan(countdown_double) and !this.warned_not_number) { - this.warned_not_number = true; - warnInvalidCountdown(globalThis, countdown_double, .TimeoutNaNWarning); + if (warn) { + if (countdown_double > std.math.maxInt(u31)) { + warnInvalidCountdown(globalThis, countdown_double, .TimeoutOverflowWarning); + } else if (countdown_double < 0 and !this.warned_negative_number) { + this.warned_negative_number = true; + warnInvalidCountdown(globalThis, countdown_double, .TimeoutNegativeWarning); + } else if (!countdown.isUndefined() and countdown.isNumber() and std.math.isNan(countdown_double) and !this.warned_not_number) { + this.warned_not_number = true; + warnInvalidCountdown(globalThis, countdown_double, .TimeoutNaNWarning); + } } break :one 1; } else @intFromFloat(countdown_double), @@ -425,12 +426,12 @@ pub const All = struct { countdown: JSValue, arguments: JSValue, overflow_behavior: CountdownOverflowBehavior, - ) callconv(.C) JSValue { + ) JSError!JSValue { JSC.markBinding(@src()); const id = globalThis.bunVM().timer.last_id; globalThis.bunVM().timer.last_id +%= 1; - const countdown_int = globalThis.bunVM().timer.jsValueToCountdown(globalThis, countdown, overflow_behavior); + const countdown_int = try globalThis.bunVM().timer.jsValueToCountdown(globalThis, countdown, overflow_behavior, true); const wrappedCallback = callback.withAsyncContextIfNeeded(globalThis); @@ -441,14 +442,14 @@ pub const All = struct { callback: JSValue, countdown: JSValue, arguments: JSValue, - ) callconv(.C) JSValue { + ) JSError!JSValue { JSC.markBinding(@src()); const id = globalThis.bunVM().timer.last_id; globalThis.bunVM().timer.last_id +%= 1; const wrappedCallback = callback.withAsyncContextIfNeeded(globalThis); - const countdown_int = globalThis.bunVM().timer.jsValueToCountdown(globalThis, countdown, .one_ms); + const countdown_int = try globalThis.bunVM().timer.jsValueToCountdown(globalThis, countdown, .one_ms, true); return set(id, globalThis, wrappedCallback, .{ .setInterval = countdown_int }, arguments); } @@ -463,7 +464,7 @@ pub const All = struct { } else return null; } - pub fn clearTimer(timer_id_value: JSValue, globalThis: *JSGlobalObject, kind: Kind) !void { + pub fn clearTimer(timer_id_value: JSValue, globalThis: *JSGlobalObject, kind: Kind) JSError!void { JSC.markBinding(@src()); const vm = globalThis.bunVM(); @@ -526,35 +527,35 @@ pub const All = struct { pub fn clearImmediate( globalThis: *JSGlobalObject, id: JSValue, - ) callconv(.c) JSValue { + ) JSError!JSValue { JSC.markBinding(@src()); - clearTimer(id, globalThis, .setImmediate) catch {}; + try clearTimer(id, globalThis, .setImmediate); return JSValue.jsUndefined(); } pub fn clearTimeout( globalThis: *JSGlobalObject, id: JSValue, - ) callconv(.c) JSValue { + ) JSError!JSValue { JSC.markBinding(@src()); - clearTimer(id, globalThis, .setTimeout) catch {}; + try clearTimer(id, globalThis, .setTimeout); return JSValue.jsUndefined(); } pub fn clearInterval( globalThis: *JSGlobalObject, id: JSValue, - ) callconv(.c) JSValue { + ) JSError!JSValue { JSC.markBinding(@src()); - clearTimer(id, globalThis, .setInterval) catch {}; + try clearTimer(id, globalThis, .setInterval); return JSValue.jsUndefined(); } comptime { @export(&setImmediate, .{ .name = "Bun__Timer__setImmediate" }); - @export(&setTimeout, .{ .name = "Bun__Timer__setTimeout" }); - @export(&setInterval, .{ .name = "Bun__Timer__setInterval" }); - @export(&clearImmediate, .{ .name = "Bun__Timer__clearImmediate" }); - @export(&clearTimeout, .{ .name = "Bun__Timer__clearTimeout" }); - @export(&clearInterval, .{ .name = "Bun__Timer__clearInterval" }); + @export(&JSC.host_fn.wrap5(setTimeout), .{ .name = "Bun__Timer__setTimeout" }); + @export(&JSC.host_fn.wrap4(setInterval), .{ .name = "Bun__Timer__setInterval" }); + @export(&JSC.host_fn.wrap2(clearImmediate), .{ .name = "Bun__Timer__clearImmediate" }); + @export(&JSC.host_fn.wrap2(clearTimeout), .{ .name = "Bun__Timer__clearTimeout" }); + @export(&JSC.host_fn.wrap2(clearInterval), .{ .name = "Bun__Timer__clearInterval" }); @export(&getNextID, .{ .name = "Bun__Timer__getNextID" }); } }; @@ -616,24 +617,24 @@ pub const TimeoutObject = struct { this.internals.runImmediateTask(vm); } - pub fn toPrimitive(this: *TimeoutObject, globalThis: *JSGlobalObject, callFrame: *JSC.CallFrame) bun.JSError!JSValue { - return this.internals.toPrimitive(globalThis, callFrame); + pub fn toPrimitive(this: *TimeoutObject, _: *JSGlobalObject, _: *JSC.CallFrame) bun.JSError!JSValue { + return this.internals.toPrimitive(); } pub fn doRef(this: *TimeoutObject, globalThis: *JSGlobalObject, callFrame: *JSC.CallFrame) bun.JSError!JSValue { - return this.internals.doRef(globalThis, callFrame); + return this.internals.doRef(globalThis, callFrame.this()); } pub fn doUnref(this: *TimeoutObject, globalThis: *JSGlobalObject, callFrame: *JSC.CallFrame) bun.JSError!JSValue { - return this.internals.doUnref(globalThis, callFrame); + return this.internals.doUnref(globalThis, callFrame.this()); } pub fn doRefresh(this: *TimeoutObject, globalThis: *JSGlobalObject, callFrame: *JSC.CallFrame) bun.JSError!JSValue { - return this.internals.doRefresh(globalThis, callFrame); + return this.internals.doRefresh(globalThis, callFrame.this()); } - pub fn hasRef(this: *TimeoutObject, globalThis: *JSGlobalObject, callFrame: *JSC.CallFrame) bun.JSError!JSValue { - return this.internals.hasRef(globalThis, callFrame); + pub fn hasRef(this: *TimeoutObject, _: *JSGlobalObject, _: *JSC.CallFrame) bun.JSError!JSValue { + return this.internals.hasRef(); } pub fn finalize(this: *TimeoutObject) void { @@ -645,10 +646,57 @@ pub const TimeoutObject = struct { return .jsBoolean(this.internals.getDestroyed()); } - pub fn dispose(this: *TimeoutObject, globalThis: *JSGlobalObject, callFrame: *JSC.CallFrame) bun.JSError!JSValue { - _ = this; - // clearTimeout works on both timeouts and intervals - _ = Timer.All.clearTimeout(globalThis, callFrame.this()); + pub fn close(this: *TimeoutObject, globalThis: *JSGlobalObject, callFrame: *JSC.CallFrame) JSValue { + this.internals.cancel(globalThis.bunVM()); + return callFrame.this(); + } + + pub fn get_onTimeout(_: *TimeoutObject, thisValue: JSValue, _: *JSGlobalObject) JSValue { + return TimeoutObject.js.callbackGetCached(thisValue).?; + } + + pub fn set_onTimeout(this: *TimeoutObject, thisValue: JSValue, globalThis: *JSGlobalObject, value: JSValue) bool { + TimeoutObject.js.callbackSetCached(thisValue, globalThis, value); + this.internals.flags.should_destroy_before_firing = !value.toBoolean(); + return true; + } + + pub fn get_idleTimeout(_: *TimeoutObject, thisValue: JSValue, _: *JSGlobalObject) JSValue { + return TimeoutObject.js.idleTimeoutGetCached(thisValue).?; + } + + pub fn set_idleTimeout(this: *TimeoutObject, thisValue: JSValue, globalThis: *JSGlobalObject, value: JSValue) bool { + TimeoutObject.js.idleTimeoutSetCached(thisValue, globalThis, value); + + if (value.isNumber()) { + const num = value.toNumber(globalThis) catch |err| switch (err) { + error.JSError => return false, + error.OutOfMemory => { + _ = globalThis.throwOutOfMemoryValue(); + return false; + }, + }; + + // cancel if the value is exactly -1 + // https://github.com/nodejs/node/blob/4cd8e1914a503ece778d642e748020e675cf1060/lib/internal/timers.js#L612-L625 + this.internals.flags.should_reschedule_interval = num != -1; + } else { + this.internals.flags.should_reschedule_interval = true; + } + + this.internals.interval = globalThis.bunVM().timer.jsValueToCountdown(globalThis, value, .one_ms, false) catch |err| switch (err) { + error.JSError => return false, + error.OutOfMemory => { + _ = globalThis.throwOutOfMemoryValue(); + return false; + }, + }; + + return true; + } + + pub fn dispose(this: *TimeoutObject, globalThis: *JSGlobalObject, _: *JSC.CallFrame) bun.JSError!JSValue { + this.internals.cancel(globalThis.bunVM()); return .undefined; } }; @@ -706,20 +754,20 @@ pub const ImmediateObject = struct { this.internals.runImmediateTask(vm); } - pub fn toPrimitive(this: *ImmediateObject, globalThis: *JSC.JSGlobalObject, callFrame: *JSC.CallFrame) bun.JSError!JSValue { - return this.internals.toPrimitive(globalThis, callFrame); + pub fn toPrimitive(this: *ImmediateObject, _: *JSC.JSGlobalObject, _: *JSC.CallFrame) bun.JSError!JSValue { + return this.internals.toPrimitive(); } pub fn doRef(this: *ImmediateObject, globalThis: *JSGlobalObject, callFrame: *JSC.CallFrame) bun.JSError!JSValue { - return this.internals.doRef(globalThis, callFrame); + return this.internals.doRef(globalThis, callFrame.this()); } pub fn doUnref(this: *ImmediateObject, globalThis: *JSGlobalObject, callFrame: *JSC.CallFrame) bun.JSError!JSValue { - return this.internals.doUnref(globalThis, callFrame); + return this.internals.doUnref(globalThis, callFrame.this()); } - pub fn hasRef(this: *ImmediateObject, globalThis: *JSGlobalObject, callFrame: *JSC.CallFrame) bun.JSError!JSValue { - return this.internals.hasRef(globalThis, callFrame); + pub fn hasRef(this: *ImmediateObject, _: *JSGlobalObject, _: *JSC.CallFrame) bun.JSError!JSValue { + return this.internals.hasRef(); } pub fn finalize(this: *ImmediateObject) void { @@ -731,22 +779,21 @@ pub const ImmediateObject = struct { return .jsBoolean(this.internals.getDestroyed()); } - pub fn dispose(this: *ImmediateObject, globalThis: *JSGlobalObject, callFrame: *JSC.CallFrame) bun.JSError!JSValue { - _ = this; - _ = Timer.All.clearImmediate(globalThis, callFrame.this()); + pub fn dispose(this: *ImmediateObject, globalThis: *JSGlobalObject, _: *JSC.CallFrame) bun.JSError!JSValue { + this.internals.cancel(globalThis.bunVM()); return .undefined; } }; /// Data that TimerObject and ImmediateObject have in common -const TimerObjectInternals = struct { +pub const TimerObjectInternals = struct { /// Identifier for this timer that is exposed to JavaScript (by `+timer`) id: i32 = -1, interval: u31 = 0, strong_this: JSC.Strong.Optional = .empty, flags: Flags = .{}, - const Flags = packed struct(u32) { + const Flags = packed struct(u34) { /// Whenever a timer is inserted into the heap (which happen on creation or refresh), the global /// epoch is incremented and the new epoch is set on the timer. For timers created by /// JavaScript, the epoch is used to break ties between timers scheduled for the same @@ -769,6 +816,14 @@ const TimerObjectInternals = struct { /// Set to `true` only during execution of the JavaScript function so that `_destroyed` can be /// false during the callback, even though the `state` will be `FIRED`. in_callback: bool = false, + + // is set `false` when `_idleTimeout` is set to -1 + // https://github.com/nodejs/node/blob/4cd8e1914a503ece778d642e748020e675cf1060/lib/internal/timers.js#L612-L626 + should_reschedule_interval: bool = true, + + // is set `true` when `_onTimeout` is set to a falsy value + // https://github.com/nodejs/node/blob/4cd8e1914a503ece778d642e748020e675cf1060/lib/internal/timers.js#L578-L592 + should_destroy_before_firing: bool = false, }; fn eventLoopTimer(this: *TimerObjectInternals) *EventLoopTimer { @@ -850,7 +905,7 @@ const TimerObjectInternals = struct { const globalThis = vm.global; - if (has_been_cleared) { + if (has_been_cleared or this.flags.should_destroy_before_firing) { if (vm.isInspectorEnabled()) { Debugger.didCancelAsyncCall(globalThis, .DOMTimer, ID.asyncID(.{ .id = id, .kind = kind })); } @@ -880,36 +935,41 @@ const TimerObjectInternals = struct { this.run(this_object, globalThis, ID.asyncID(.{ .id = id, .kind = kind }), vm); - var is_timer_done = false; + const is_timer_done = is_timer_done: { + // Node doesn't drain microtasks after each timer callback. + if (kind == .setInterval) { + if (!this.flags.should_reschedule_interval) { + break :is_timer_done true; + } + switch (this.eventLoopTimer().state) { + .FIRED => { + // If we didn't clear the setInterval, reschedule it starting from + vm.timer.update(this.eventLoopTimer(), &time_before_call); - // Node doesn't drain microtasks after each timer callback. - if (kind == .setInterval) { - switch (this.eventLoopTimer().state) { - .FIRED => { - // If we didn't clear the setInterval, reschedule it starting from - vm.timer.update(this.eventLoopTimer(), &time_before_call); + if (this.flags.has_js_ref) { + this.setEnableKeepingEventLoopAlive(vm, true); + } - if (this.flags.has_js_ref) { - this.setEnableKeepingEventLoopAlive(vm, true); - } + // The ref count doesn't change. It wasn't decremented. + }, + .ACTIVE => { + // The developer called timer.refresh() synchronously in the callback. + vm.timer.update(this.eventLoopTimer(), &time_before_call); - // The ref count doesn't change. It wasn't decremented. - }, - .ACTIVE => { - // The developer called timer.refresh() synchronously in the callback. - vm.timer.update(this.eventLoopTimer(), &time_before_call); - - // Balance out the ref count. - // the transition from "FIRED" -> "ACTIVE" caused it to increment. - this.deref(); - }, - else => { - is_timer_done = true; - }, + // Balance out the ref count. + // the transition from "FIRED" -> "ACTIVE" caused it to increment. + this.deref(); + }, + else => { + break :is_timer_done true; + }, + } + } else if (this.eventLoopTimer().state == .FIRED) { + break :is_timer_done true; } - } else if (this.eventLoopTimer().state == .FIRED) { - is_timer_done = true; - } + + break :is_timer_done false; + }; if (is_timer_done) { this.setEnableKeepingEventLoopAlive(vm, false); @@ -969,6 +1029,7 @@ const TimerObjectInternals = struct { if (arguments != .zero) TimeoutObject.js.argumentsSetCached(timer_js, globalThis, arguments); TimeoutObject.js.callbackSetCached(timer_js, globalThis, callback); + TimeoutObject.js.idleTimeoutSetCached(timer_js, globalThis, JSC.jsNumber(interval)); // this increments the refcount this.reschedule(vm); } @@ -976,8 +1037,7 @@ const TimerObjectInternals = struct { this.strong_this.set(globalThis, timer_js); } - pub fn doRef(this: *TimerObjectInternals, _: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!JSValue { - const this_value = callframe.this(); + pub fn doRef(this: *TimerObjectInternals, _: *JSC.JSGlobalObject, this_value: JSValue) JSValue { this_value.ensureStillAlive(); const did_have_js_ref = this.flags.has_js_ref; @@ -990,8 +1050,7 @@ const TimerObjectInternals = struct { return this_value; } - pub fn doRefresh(this: *TimerObjectInternals, globalObject: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!JSValue { - const this_value = callframe.this(); + pub fn doRefresh(this: *TimerObjectInternals, globalObject: *JSC.JSGlobalObject, this_value: JSValue) JSValue { // Immediates do not have a refresh function, and our binding generator should not let this // function be reached even if you override the `this` value calling a Timeout object's // `refresh` method @@ -1008,8 +1067,7 @@ const TimerObjectInternals = struct { return this_value; } - pub fn doUnref(this: *TimerObjectInternals, _: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!JSValue { - const this_value = callframe.this(); + pub fn doUnref(this: *TimerObjectInternals, _: *JSC.JSGlobalObject, this_value: JSValue) JSValue { this_value.ensureStillAlive(); const did_have_js_ref = this.flags.has_js_ref; @@ -1041,6 +1099,7 @@ const TimerObjectInternals = struct { pub fn reschedule(this: *TimerObjectInternals, vm: *VirtualMachine) void { if (this.flags.kind == .setImmediate) return; + if (!this.flags.should_reschedule_interval) return; const now = timespec.msFromNow(this.interval); const was_active = this.eventLoopTimer().state == .ACTIVE; @@ -1071,15 +1130,15 @@ const TimerObjectInternals = struct { } } - pub fn hasRef(this: *TimerObjectInternals, _: *JSC.JSGlobalObject, _: *JSC.CallFrame) bun.JSError!JSValue { + pub fn hasRef(this: *TimerObjectInternals) JSValue { return JSValue.jsBoolean(this.flags.is_keeping_event_loop_alive); } - pub fn toPrimitive(this: *TimerObjectInternals, _: *JSC.JSGlobalObject, _: *JSC.CallFrame) bun.JSError!JSValue { + pub fn toPrimitive(this: *TimerObjectInternals) bun.JSError!JSValue { if (!this.flags.has_accessed_primitive) { this.flags.has_accessed_primitive = true; const vm = VirtualMachine.get(); - vm.timer.maps.get(this.flags.kind).put(bun.default_allocator, this.id, this.eventLoopTimer()) catch bun.outOfMemory(); + try vm.timer.maps.get(this.flags.kind).put(bun.default_allocator, this.id, this.eventLoopTimer()); } return JSValue.jsNumber(this.id); } diff --git a/src/bun.js/bindings/BunObject.cpp b/src/bun.js/bindings/BunObject.cpp index 3dc7ba9ccd..59bd982702 100644 --- a/src/bun.js/bindings/BunObject.cpp +++ b/src/bun.js/bindings/BunObject.cpp @@ -630,7 +630,7 @@ JSC_DEFINE_HOST_FUNCTION(functionFileURLToPath, (JSC::JSGlobalObject * globalObj WTF::URL url; auto path = JSC::JSValue::encode(arg0); - auto* domURL = WebCoreCast(path); + auto* domURL = WebCoreCast(path); if (!domURL) { if (arg0.isString()) { url = WTF::URL(arg0.toWTFString(globalObject)); diff --git a/src/bun.js/bindings/BunString.cpp b/src/bun.js/bindings/BunString.cpp index 4b1df7cf96..aaaf352ad0 100644 --- a/src/bun.js/bindings/BunString.cpp +++ b/src/bun.js/bindings/BunString.cpp @@ -467,7 +467,7 @@ extern "C" BunString URL__getFileURLString(BunString* filePath) return Bun::toStringRef(WTF::URL::fileURLWithFileSystemPath(filePath->toWTFString()).stringWithoutFragmentIdentifier()); } -extern "C" JSC__JSValue BunString__toJSDOMURL(JSC::JSGlobalObject* lexicalGlobalObject, BunString* bunString) +extern "C" JSC::EncodedJSValue BunString__toJSDOMURL(JSC::JSGlobalObject* lexicalGlobalObject, BunString* bunString) { auto& globalObject = *jsCast(lexicalGlobalObject); auto& vm = globalObject.vm(); diff --git a/src/bun.js/bindings/ConsoleObject.cpp b/src/bun.js/bindings/ConsoleObject.cpp index 3eab5e2ad3..7bd750f6bd 100644 --- a/src/bun.js/bindings/ConsoleObject.cpp +++ b/src/bun.js/bindings/ConsoleObject.cpp @@ -26,7 +26,7 @@ using namespace Inspector; using ScriptArguments = Inspector::ScriptArguments; using MessageType = JSC::MessageType; using MessageLevel = JSC::MessageLevel; -using JSGlobalObject = JSC__JSGlobalObject; +using JSGlobalObject = JSC::JSGlobalObject; using String = WTF::String; @@ -41,7 +41,7 @@ void ConsoleObject::messageWithTypeAndLevel(MessageType type, MessageLevel level } auto& vm = JSC::getVM(globalObject); auto args = arguments.ptr(); - JSC__JSValue jsArgs[255]; + JSC::EncodedJSValue jsArgs[255]; auto count = std::min(args->argumentCount(), (size_t)255); for (size_t i = 0; i < count; i++) { @@ -85,7 +85,7 @@ void ConsoleObject::timeLog(JSGlobalObject* globalObject, const String& label, auto input = label.tryGetUTF8().value(); auto args = arguments.ptr(); - JSC__JSValue jsArgs[255]; + JSC::EncodedJSValue jsArgs[255]; auto count = std::min(args->argumentCount(), (size_t)255); for (size_t i = 0; i < count; i++) { auto val = args->argumentAt(i); diff --git a/src/bun.js/bindings/ImportMetaObject.cpp b/src/bun.js/bindings/ImportMetaObject.cpp index aeb302ce75..7062e14820 100644 --- a/src/bun.js/bindings/ImportMetaObject.cpp +++ b/src/bun.js/bindings/ImportMetaObject.cpp @@ -147,7 +147,7 @@ ImportMetaObject* ImportMetaObject::create(JSC::JSGlobalObject* globalObject, co ImportMetaObject* ImportMetaObject::create(JSC::JSGlobalObject* globalObject, JSValue specifierOrURL) { - if (WebCore::DOMURL* url = WebCoreCast(JSValue::encode(specifierOrURL))) { + if (WebCore::DOMURL* url = WebCoreCast(JSValue::encode(specifierOrURL))) { return create(globalObject, url->href().string()); } @@ -199,7 +199,7 @@ extern "C" JSC::EncodedJSValue functionImportMeta__resolveSync(JSC::JSGlobalObje return {}; } - JSC__JSValue from = JSC::JSValue::encode(JSC::jsUndefined()); + JSC::EncodedJSValue from = JSC::JSValue::encode(JSC::jsUndefined()); bool isESM = true; if (callFrame->argumentCount() > 1) { diff --git a/src/bun.js/bindings/JSPromise.zig b/src/bun.js/bindings/JSPromise.zig index 58874d2564..6249b5d408 100644 --- a/src/bun.js/bindings/JSPromise.zig +++ b/src/bun.js/bindings/JSPromise.zig @@ -17,7 +17,6 @@ pub const JSPromise = opaque { extern fn JSC__JSPromise__isHandled(arg0: *const JSPromise, arg1: *VM) bool; extern fn JSC__JSPromise__reject(arg0: *JSPromise, arg1: *JSGlobalObject, JSValue2: JSValue) void; extern fn JSC__JSPromise__rejectAsHandled(arg0: *JSPromise, arg1: *JSGlobalObject, JSValue2: JSValue) void; - extern fn JSC__JSPromise__rejectAsHandledException(arg0: *JSPromise, arg1: *JSGlobalObject, arg2: ?*JSC.Exception) void; extern fn JSC__JSPromise__rejectedPromise(arg0: *JSGlobalObject, JSValue1: JSValue) *JSPromise; /// **DEPRECATED** This function does not notify the VM about the rejection, /// meaning it will not trigger unhandled rejection handling. Use JSC__JSPromise__rejectedPromise instead. diff --git a/src/bun.js/bindings/JSSocketAddressDTO.cpp b/src/bun.js/bindings/JSSocketAddressDTO.cpp index ad7fbda56b..025549ce44 100644 --- a/src/bun.js/bindings/JSSocketAddressDTO.cpp +++ b/src/bun.js/bindings/JSSocketAddressDTO.cpp @@ -67,7 +67,7 @@ Structure* createStructure(VM& vm, JSGlobalObject* globalObject) } // namespace JSSocketAddress } // namespace Bun -extern "C" JSC__JSValue JSSocketAddressDTO__create(JSGlobalObject* globalObject, EncodedJSValue address, int32_t port, bool isIPv6) +extern "C" JSC::EncodedJSValue JSSocketAddressDTO__create(JSGlobalObject* globalObject, EncodedJSValue address, int32_t port, bool isIPv6) { ASSERT(port < std::numeric_limits::max()); diff --git a/src/bun.js/bindings/JSSocketAddressDTO.h b/src/bun.js/bindings/JSSocketAddressDTO.h index b86015736b..32a69248af 100644 --- a/src/bun.js/bindings/JSSocketAddressDTO.h +++ b/src/bun.js/bindings/JSSocketAddressDTO.h @@ -16,4 +16,4 @@ JSObject* create(Zig::GlobalObject* globalObject, JSString* value, int port, boo } // namespace JSSocketAddress } // namespace Bun -extern "C" JSC__JSValue JSSocketAddressDTO__create(JSGlobalObject* globalObject, EncodedJSValue address, int32_t port, bool isIPv6); +extern "C" JSC::EncodedJSValue JSSocketAddressDTO__create(JSGlobalObject* globalObject, EncodedJSValue address, int32_t port, bool isIPv6); diff --git a/src/bun.js/bindings/JSUint8Array.zig b/src/bun.js/bindings/JSUint8Array.zig index a9830dac1f..c745ba9590 100644 --- a/src/bun.js/bindings/JSUint8Array.zig +++ b/src/bun.js/bindings/JSUint8Array.zig @@ -6,7 +6,6 @@ const JSGlobalObject = JSC.JSGlobalObject; const JSValue = JSC.JSValue; pub const JSUint8Array = opaque { - pub const name = "Uint8Array_alias"; pub fn ptr(this: *JSUint8Array) [*]u8 { return @as(*[*]u8, @ptrFromInt(@intFromPtr(this) + Sizes.Bun_FFI_PointerOffsetToTypedArrayVector)).*; } diff --git a/src/bun.js/bindings/JSValue.zig b/src/bun.js/bindings/JSValue.zig index 18314dd62c..d13ab88e1e 100644 --- a/src/bun.js/bindings/JSValue.zig +++ b/src/bun.js/bindings/JSValue.zig @@ -580,8 +580,7 @@ pub const JSValue = enum(i64) { pub fn toPortNumber(this: JSValue, global: *JSGlobalObject) bun.JSError!u16 { if (this.isNumber()) { - // const double = try this.toNumber(global); - const double = this.coerceToDouble(global); + const double = try this.toNumber(global); if (std.math.isNan(double)) { return JSC.Error.SOCKET_BAD_PORT.throw(global, "Invalid port number", .{}); } diff --git a/src/bun.js/bindings/NodeTimerObject.cpp b/src/bun.js/bindings/NodeTimerObject.cpp index 8e24b82adc..5b41011b73 100644 --- a/src/bun.js/bindings/NodeTimerObject.cpp +++ b/src/bun.js/bindings/NodeTimerObject.cpp @@ -25,7 +25,13 @@ void callInternal(T* timeout, JSGlobalObject* globalObject) auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); - JSCell* callbackCell = timeout->m_callback.get().asCell(); + JSValue callbackValue = timeout->m_callback.get(); + JSCell* callbackCell = callbackValue.isCell() ? callbackValue.asCell() : nullptr; + if (!callbackCell) { + Bun__reportUnhandledError(globalObject, JSValue::encode(createNotAFunctionError(globalObject, callbackValue))); + return; + } + JSValue restoreAsyncContext {}; JSC::InternalFieldTuple* asyncContextData = nullptr; @@ -45,6 +51,12 @@ void callInternal(T* timeout, JSGlobalObject* globalObject) } default: { + auto callData = JSC::getCallData(callbackCell); + if (callData.type == CallData::Type::None) { + Bun__reportUnhandledError(globalObject, JSValue::encode(createNotAFunctionError(globalObject, callbackValue))); + return; + } + MarkedArgumentBuffer args; if (timeout->m_arguments) { JSValue argumentsValue = timeout->m_arguments.get(); diff --git a/src/bun.js/bindings/UtilInspect.cpp b/src/bun.js/bindings/UtilInspect.cpp index 92c6105914..cdb3c8ed0e 100644 --- a/src/bun.js/bindings/UtilInspect.cpp +++ b/src/bun.js/bindings/UtilInspect.cpp @@ -37,8 +37,8 @@ JSObject* createInspectOptionsObject(VM& vm, Zig::GlobalObject* globalObject, un extern "C" JSC::EncodedJSValue JSC__JSValue__callCustomInspectFunction( Zig::GlobalObject* globalObject, - JSC__JSValue encodedFunctionValue, - JSC__JSValue encodedThisValue, + JSC::EncodedJSValue encodedFunctionValue, + JSC::EncodedJSValue encodedThisValue, unsigned depth, unsigned max_depth, bool colors, diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index f19538224a..2b8452d33a 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -182,6 +182,7 @@ #include "ProcessBindingBuffer.h" #include "NodeValidator.h" #include "ProcessBindingFs.h" +#include "node/NodeTimers.h" #include "JSBunRequest.h" #include "ServerRouteList.h" @@ -896,7 +897,7 @@ void Zig::GlobalObject::resetOnEachMicrotaskTick() // executionContextId: -1 for main thread // executionContextId: maxInt32 for macros // executionContextId: >-1 for workers -extern "C" JSC__JSGlobalObject* Zig__GlobalObject__create(void* console_client, int32_t executionContextId, bool miniMode, bool evalMode, void* worker_ptr) +extern "C" JSC::JSGlobalObject* Zig__GlobalObject__create(void* console_client, int32_t executionContextId, bool miniMode, bool evalMode, void* worker_ptr) { auto heapSize = miniMode ? JSC::HeapType::Small : JSC::HeapType::Large; RefPtr vmPtr = JSC::VM::tryCreate(heapSize); @@ -1073,7 +1074,7 @@ JSC_DEFINE_HOST_FUNCTION(functionFulfillModuleSync, RELEASE_AND_RETURN(scope, JSValue::encode(JSC::jsUndefined())); } -extern "C" void* Zig__GlobalObject__getModuleRegistryMap(JSC__JSGlobalObject* arg0) +extern "C" void* Zig__GlobalObject__getModuleRegistryMap(JSC::JSGlobalObject* arg0) { if (JSC::JSObject* loader = JSC::jsDynamicCast(arg0->moduleLoader())) { JSC::JSMap* map = JSC::jsDynamicCast( @@ -1088,7 +1089,7 @@ extern "C" void* Zig__GlobalObject__getModuleRegistryMap(JSC__JSGlobalObject* ar return nullptr; } -extern "C" bool Zig__GlobalObject__resetModuleRegistryMap(JSC__JSGlobalObject* globalObject, +extern "C" bool Zig__GlobalObject__resetModuleRegistryMap(JSC::JSGlobalObject* globalObject, void* map_ptr) { if (map_ptr == nullptr) @@ -1530,183 +1531,6 @@ JSC_DEFINE_HOST_FUNCTION(functionNativeMicrotaskTrampoline, return JSValue::encode(jsUndefined()); } -JSC_DEFINE_HOST_FUNCTION(functionSetTimeout, - (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) -{ - auto& vm = JSC::getVM(globalObject); - JSC::JSValue job = callFrame->argument(0); - JSC::JSValue num = callFrame->argument(1); - JSC::JSValue arguments = {}; - size_t argumentCount = callFrame->argumentCount(); - auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); - switch (argumentCount) { - case 0: { - Bun::throwError(globalObject, scope, ErrorCode::ERR_INVALID_ARG_TYPE, "setTimeout requires 1 argument (a function)"_s); - return {}; - } - case 1: - case 2: { - break; - } - case 3: { - arguments = callFrame->argument(2); - break; - } - - default: { - ArgList argumentsList = ArgList(callFrame, 2); - auto* args = JSC::JSImmutableButterfly::tryCreateFromArgList(vm, argumentsList); - - if (UNLIKELY(!args)) { - JSC::throwOutOfMemoryError(globalObject, scope); - return {}; - } - - arguments = JSValue(args); - } - } - - if (UNLIKELY(!job.isObject() || !job.getObject()->isCallable())) { - Bun::throwError(globalObject, scope, ErrorCode::ERR_INVALID_ARG_TYPE, "setTimeout expects a function"_s); - return {}; - } - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return Bun__Timer__setTimeout(globalObject, JSC::JSValue::encode(job), JSC::JSValue::encode(num), JSValue::encode(arguments), Bun::CountdownOverflowBehavior::OneMs); -} - -JSC_DEFINE_HOST_FUNCTION(functionSetInterval, - (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) -{ - auto& vm = JSC::getVM(globalObject); - JSC::JSValue job = callFrame->argument(0); - JSC::JSValue num = callFrame->argument(1); - JSC::JSValue arguments = {}; - size_t argumentCount = callFrame->argumentCount(); - auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); - - switch (argumentCount) { - case 0: { - Bun::throwError(globalObject, scope, ErrorCode::ERR_INVALID_ARG_TYPE, "setInterval requires 1 argument (a function)"_s); - return {}; - } - case 1: { - num = jsNumber(0); - break; - } - case 2: { - break; - } - case 3: { - arguments = callFrame->argument(2); - break; - } - - default: { - ArgList argumentsList = ArgList(callFrame, 2); - auto* args = JSC::JSImmutableButterfly::tryCreateFromArgList(vm, argumentsList); - - if (UNLIKELY(!args)) { - JSC::throwOutOfMemoryError(globalObject, scope); - return {}; - } - - arguments = JSValue(args); - } - } - - if (UNLIKELY(!job.isObject() || !job.getObject()->isCallable())) { - Bun::throwError(globalObject, scope, ErrorCode::ERR_INVALID_ARG_TYPE, "setInterval expects a function"_s); - return {}; - } - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return Bun__Timer__setInterval(globalObject, JSC::JSValue::encode(job), JSC::JSValue::encode(num), JSValue::encode(arguments)); -} - -JSC_DEFINE_HOST_FUNCTION(functionClearImmediate, - (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) -{ - auto& vm = JSC::getVM(globalObject); - - JSC::JSValue timer_or_num = callFrame->argument(0); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return Bun__Timer__clearImmediate(globalObject, JSC::JSValue::encode(timer_or_num)); -} - -JSC_DEFINE_HOST_FUNCTION(functionClearInterval, - (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) -{ - auto& vm = JSC::getVM(globalObject); - - JSC::JSValue timer_or_num = callFrame->argument(0); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return Bun__Timer__clearInterval(globalObject, JSC::JSValue::encode(timer_or_num)); -} - -JSC_DEFINE_HOST_FUNCTION(functionClearTimeout, - (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) -{ - auto& vm = JSC::getVM(globalObject); - - JSC::JSValue timer_or_num = callFrame->argument(0); - -#ifdef BUN_DEBUG - /** View the file name of the JS file that called this function - * from a debugger */ - SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); - const char* fileName = sourceOrigin.string().utf8().data(); - static const char* lastFileName = nullptr; - if (lastFileName != fileName) { - lastFileName = fileName; - } -#endif - - return Bun__Timer__clearTimeout(globalObject, JSC::JSValue::encode(timer_or_num)); -} - JSC_DEFINE_HOST_FUNCTION(functionStructuredClone, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { @@ -1840,7 +1664,7 @@ JSC_DEFINE_HOST_FUNCTION(functionReportError, return JSC::JSValue::encode(JSC::jsUndefined()); } -extern "C" JSC__JSValue ArrayBuffer__fromSharedMemfd(int64_t fd, JSC::JSGlobalObject* globalObject, size_t byteOffset, size_t byteLength, size_t totalLength, JSC::JSType type) +extern "C" JSC::EncodedJSValue ArrayBuffer__fromSharedMemfd(int64_t fd, JSC::JSGlobalObject* globalObject, size_t byteOffset, size_t byteLength, size_t totalLength, JSC::JSType type) { // Windows doesn't have mmap @@ -1878,7 +1702,7 @@ extern "C" JSC__JSValue ArrayBuffer__fromSharedMemfd(int64_t fd, JSC::JSGlobalOb #endif } -extern "C" JSC__JSValue Bun__createArrayBufferForCopy(JSC::JSGlobalObject* globalObject, const void* ptr, size_t len) +extern "C" JSC::EncodedJSValue Bun__createArrayBufferForCopy(JSC::JSGlobalObject* globalObject, const void* ptr, size_t len) { auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); auto arrayBuffer = JSC::ArrayBuffer::tryCreateUninitialized(len, 1); @@ -1894,7 +1718,7 @@ extern "C" JSC__JSValue Bun__createArrayBufferForCopy(JSC::JSGlobalObject* globa RELEASE_AND_RETURN(scope, JSValue::encode(JSC::JSArrayBuffer::create(globalObject->vm(), globalObject->arrayBufferStructure(JSC::ArrayBufferSharingMode::Default), WTFMove(arrayBuffer)))); } -extern "C" JSC__JSValue Bun__allocUint8ArrayForCopy(JSC::JSGlobalObject* globalObject, size_t len, void** ptr) +extern "C" JSC::EncodedJSValue Bun__allocUint8ArrayForCopy(JSC::JSGlobalObject* globalObject, size_t len, void** ptr) { auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); @@ -1910,7 +1734,7 @@ extern "C" JSC__JSValue Bun__allocUint8ArrayForCopy(JSC::JSGlobalObject* globalO return JSValue::encode(array); } -extern "C" JSC__JSValue Bun__allocArrayBufferForCopy(JSC::JSGlobalObject* lexicalGlobalObject, size_t len, void** ptr) +extern "C" JSC::EncodedJSValue Bun__allocArrayBufferForCopy(JSC::JSGlobalObject* lexicalGlobalObject, size_t len, void** ptr) { auto& vm = JSC::getVM(lexicalGlobalObject); auto scope = DECLARE_THROW_SCOPE(vm); @@ -1928,7 +1752,7 @@ extern "C" JSC__JSValue Bun__allocArrayBufferForCopy(JSC::JSGlobalObject* lexica return JSValue::encode(buf); } -extern "C" JSC__JSValue Bun__createUint8ArrayForCopy(JSC::JSGlobalObject* globalObject, const void* ptr, size_t len, bool isBuffer) +extern "C" JSC::EncodedJSValue Bun__createUint8ArrayForCopy(JSC::JSGlobalObject* globalObject, const void* ptr, size_t len, bool isBuffer) { VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -2184,7 +2008,7 @@ static inline std::optional invokeReadableStreamFunction(JSC::JSGl return {}; return result; } -extern "C" bool ReadableStream__tee(JSC__JSValue possibleReadableStream, Zig::GlobalObject* globalObject, JSC__JSValue* possibleReadableStream1, JSC__JSValue* possibleReadableStream2) +extern "C" bool ReadableStream__tee(JSC::EncodedJSValue possibleReadableStream, Zig::GlobalObject* globalObject, JSC::EncodedJSValue* possibleReadableStream1, JSC::EncodedJSValue* possibleReadableStream2) { auto* readableStream = jsDynamicCast(JSC::JSValue::decode(possibleReadableStream)); if (UNLIKELY(!readableStream)) @@ -2210,7 +2034,7 @@ extern "C" bool ReadableStream__tee(JSC__JSValue possibleReadableStream, Zig::Gl return true; } -extern "C" void ReadableStream__cancel(JSC__JSValue possibleReadableStream, Zig::GlobalObject* globalObject) +extern "C" void ReadableStream__cancel(JSC::EncodedJSValue possibleReadableStream, Zig::GlobalObject* globalObject) { auto* readableStream = jsDynamicCast(JSC::JSValue::decode(possibleReadableStream)); if (UNLIKELY(!readableStream)) @@ -2224,7 +2048,7 @@ extern "C" void ReadableStream__cancel(JSC__JSValue possibleReadableStream, Zig: ReadableStream::cancel(*globalObject, readableStream, exception); } -extern "C" void ReadableStream__detach(JSC__JSValue possibleReadableStream, Zig::GlobalObject* globalObject) +extern "C" void ReadableStream__detach(JSC::EncodedJSValue possibleReadableStream, Zig::GlobalObject* globalObject) { auto value = JSC::JSValue::decode(possibleReadableStream); if (value.isEmpty() || !value.isCell()) @@ -2237,22 +2061,22 @@ extern "C" void ReadableStream__detach(JSC__JSValue possibleReadableStream, Zig: readableStream->setNativeType(0); readableStream->setDisturbed(true); } -extern "C" bool ReadableStream__isDisturbed(JSC__JSValue possibleReadableStream, Zig::GlobalObject* globalObject); -extern "C" bool ReadableStream__isDisturbed(JSC__JSValue possibleReadableStream, Zig::GlobalObject* globalObject) +extern "C" bool ReadableStream__isDisturbed(JSC::EncodedJSValue possibleReadableStream, Zig::GlobalObject* globalObject); +extern "C" bool ReadableStream__isDisturbed(JSC::EncodedJSValue possibleReadableStream, Zig::GlobalObject* globalObject) { ASSERT(globalObject); return ReadableStream::isDisturbed(globalObject, jsDynamicCast(JSC::JSValue::decode(possibleReadableStream))); } -extern "C" bool ReadableStream__isLocked(JSC__JSValue possibleReadableStream, Zig::GlobalObject* globalObject); -extern "C" bool ReadableStream__isLocked(JSC__JSValue possibleReadableStream, Zig::GlobalObject* globalObject) +extern "C" bool ReadableStream__isLocked(JSC::EncodedJSValue possibleReadableStream, Zig::GlobalObject* globalObject); +extern "C" bool ReadableStream__isLocked(JSC::EncodedJSValue possibleReadableStream, Zig::GlobalObject* globalObject) { ASSERT(globalObject); WebCore::JSReadableStream* stream = jsDynamicCast(JSValue::decode(possibleReadableStream)); return stream != nullptr && ReadableStream::isLocked(globalObject, stream); } -extern "C" int32_t ReadableStreamTag__tagged(Zig::GlobalObject* globalObject, JSC__JSValue* possibleReadableStream, void** ptr) +extern "C" int32_t ReadableStreamTag__tagged(Zig::GlobalObject* globalObject, JSC::EncodedJSValue* possibleReadableStream, void** ptr) { ASSERT(globalObject); JSC::JSObject* object = JSValue::decode(*possibleReadableStream).getObject(); @@ -2341,7 +2165,7 @@ extern "C" int32_t ReadableStreamTag__tagged(Zig::GlobalObject* globalObject, JS return 0; } -extern "C" JSC__JSValue ZigGlobalObject__createNativeReadableStream(Zig::GlobalObject* globalObject, JSC__JSValue nativePtr) +extern "C" JSC::EncodedJSValue ZigGlobalObject__createNativeReadableStream(Zig::GlobalObject* globalObject, JSC::EncodedJSValue nativePtr) { auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); @@ -2356,18 +2180,18 @@ extern "C" JSC__JSValue ZigGlobalObject__createNativeReadableStream(Zig::GlobalO return JSC::JSValue::encode(call(globalObject, function, callData, JSC::jsUndefined(), arguments)); } -extern "C" JSC__JSValue Bun__Jest__createTestModuleObject(JSC::JSGlobalObject*); -extern "C" JSC__JSValue Bun__Jest__createTestPreloadObject(JSC::JSGlobalObject*); -extern "C" JSC__JSValue Bun__Jest__testPreloadObject(Zig::GlobalObject* globalObject) +extern "C" JSC::EncodedJSValue Bun__Jest__createTestModuleObject(JSC::JSGlobalObject*); +extern "C" JSC::EncodedJSValue Bun__Jest__createTestPreloadObject(JSC::JSGlobalObject*); +extern "C" JSC::EncodedJSValue Bun__Jest__testPreloadObject(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->lazyPreloadTestModuleObject()); } -extern "C" JSC__JSValue Bun__Jest__testModuleObject(Zig::GlobalObject* globalObject) +extern "C" JSC::EncodedJSValue Bun__Jest__testModuleObject(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->lazyTestModuleObject()); } -static inline JSC__JSValue ZigGlobalObject__readableStreamToArrayBufferBody(Zig::GlobalObject* globalObject, JSC__JSValue readableStreamValue) +static inline JSC::EncodedJSValue ZigGlobalObject__readableStreamToArrayBufferBody(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue) { auto& vm = JSC::getVM(globalObject); @@ -2406,14 +2230,14 @@ static inline JSC__JSValue ZigGlobalObject__readableStreamToArrayBufferBody(Zig: RELEASE_AND_RETURN(throwScope, JSC::JSValue::encode(promise)); } -extern "C" JSC__JSValue ZigGlobalObject__readableStreamToArrayBuffer(Zig::GlobalObject* globalObject, JSC__JSValue readableStreamValue); -extern "C" JSC__JSValue ZigGlobalObject__readableStreamToArrayBuffer(Zig::GlobalObject* globalObject, JSC__JSValue readableStreamValue) +extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToArrayBuffer(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue); +extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToArrayBuffer(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue) { return ZigGlobalObject__readableStreamToArrayBufferBody(reinterpret_cast(globalObject), readableStreamValue); } -extern "C" JSC__JSValue ZigGlobalObject__readableStreamToBytes(Zig::GlobalObject* globalObject, JSC__JSValue readableStreamValue); -extern "C" JSC__JSValue ZigGlobalObject__readableStreamToBytes(Zig::GlobalObject* globalObject, JSC__JSValue readableStreamValue) +extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToBytes(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue); +extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToBytes(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue) { auto& vm = JSC::getVM(globalObject); @@ -2452,8 +2276,8 @@ extern "C" JSC__JSValue ZigGlobalObject__readableStreamToBytes(Zig::GlobalObject RELEASE_AND_RETURN(throwScope, JSC::JSValue::encode(promise)); } -extern "C" JSC__JSValue ZigGlobalObject__readableStreamToText(Zig::GlobalObject* globalObject, JSC__JSValue readableStreamValue); -extern "C" JSC__JSValue ZigGlobalObject__readableStreamToText(Zig::GlobalObject* globalObject, JSC__JSValue readableStreamValue) +extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToText(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue); +extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToText(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue) { auto& vm = JSC::getVM(globalObject); @@ -2473,7 +2297,7 @@ extern "C" JSC__JSValue ZigGlobalObject__readableStreamToText(Zig::GlobalObject* return JSC::JSValue::encode(call(globalObject, function, callData, JSC::jsUndefined(), arguments)); } -extern "C" JSC__JSValue ZigGlobalObject__readableStreamToFormData(Zig::GlobalObject* globalObject, JSC__JSValue readableStreamValue, JSC__JSValue contentTypeValue) +extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToFormData(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue, JSC::EncodedJSValue contentTypeValue) { auto& vm = JSC::getVM(globalObject); @@ -2494,8 +2318,8 @@ extern "C" JSC__JSValue ZigGlobalObject__readableStreamToFormData(Zig::GlobalObj return JSC::JSValue::encode(call(globalObject, function, callData, JSC::jsUndefined(), arguments)); } -extern "C" JSC__JSValue ZigGlobalObject__readableStreamToJSON(Zig::GlobalObject* globalObject, JSC__JSValue readableStreamValue); -extern "C" JSC__JSValue ZigGlobalObject__readableStreamToJSON(Zig::GlobalObject* globalObject, JSC__JSValue readableStreamValue) +extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToJSON(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue); +extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToJSON(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue) { auto& vm = JSC::getVM(globalObject); @@ -2515,7 +2339,7 @@ extern "C" JSC__JSValue ZigGlobalObject__readableStreamToJSON(Zig::GlobalObject* return JSC::JSValue::encode(call(globalObject, function, callData, JSC::jsUndefined(), arguments)); } -extern "C" JSC__JSValue ZigGlobalObject__readableStreamToBlob(Zig::GlobalObject* globalObject, JSC__JSValue readableStreamValue) +extern "C" JSC::EncodedJSValue ZigGlobalObject__readableStreamToBlob(Zig::GlobalObject* globalObject, JSC::EncodedJSValue readableStreamValue) { auto& vm = JSC::getVM(globalObject); @@ -3309,7 +3133,8 @@ void GlobalObject::finishCreation(VM& vm) m_processObject.initLater( [](const JSC::LazyProperty::Initializer& init) { - Zig::GlobalObject* globalObject = reinterpret_cast(init.owner); + auto* globalObject = defaultGlobalObject(init.owner); + auto* process = Bun::Process::create( *globalObject, Bun::Process::createStructure(init.vm, init.owner, WebCore::JSEventEmitter::prototype(init.vm, *globalObject))); @@ -3569,53 +3394,6 @@ JSC_DEFINE_CUSTOM_SETTER(JSDOMFileConstructor_setter, return true; } -extern "C" JSC__JSValue Bun__Timer__setImmediate(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue JSValue3); -// https://developer.mozilla.org/en-US/docs/Web/API/Window/setImmediate -JSC_DEFINE_HOST_FUNCTION(functionSetImmediate, - (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) -{ - auto& vm = JSC::getVM(globalObject); - auto scope = DECLARE_THROW_SCOPE(vm); - - auto argCount = callFrame->argumentCount(); - if (argCount == 0) { - Bun::throwError(globalObject, scope, ErrorCode::ERR_INVALID_ARG_TYPE, "setImmediate requires 1 argument (a function)"_s); - return {}; - } - - auto job = callFrame->argument(0); - - if (!job.isObject() || !job.getObject()->isCallable()) { - Bun::throwError(globalObject, scope, ErrorCode::ERR_INVALID_ARG_TYPE, "setImmediate expects a function"_s); - return {}; - } - - JSC::JSValue arguments = {}; - switch (argCount) { - case 0: - case 1: { - break; - } - case 2: { - arguments = callFrame->argument(1); - break; - } - default: { - ArgList argumentsList = ArgList(callFrame, 1); - auto* args = JSC::JSImmutableButterfly::tryCreateFromArgList(vm, argumentsList); - - if (UNLIKELY(!args)) { - JSC::throwOutOfMemoryError(globalObject, scope); - return {}; - } - - arguments = JSValue(args); - } - } - - return Bun__Timer__setImmediate(globalObject, JSC::JSValue::encode(job), JSValue::encode(arguments)); -} - // `console.Console` or `import { Console } from 'console';` JSC_DEFINE_CUSTOM_GETTER(getConsoleConstructor, (JSGlobalObject * globalObject, EncodedJSValue thisValue, PropertyName property)) { @@ -3936,7 +3714,7 @@ JSC_DEFINE_HOST_FUNCTION(functionJsGc, return JSValue::encode(jsUndefined()); } -extern "C" void JSC__JSGlobalObject__addGc(JSC__JSGlobalObject* globalObject) +extern "C" void JSC__JSGlobalObject__addGc(JSC::JSGlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); globalObject->putDirectNativeFunction(vm, globalObject, JSC::Identifier::fromString(vm, "gc"_s), 0, functionJsGc, ImplementationVisibility::Public, JSC::NoIntrinsic, PropertyAttribute::DontEnum | 0); @@ -3944,17 +3722,6 @@ extern "C" void JSC__JSGlobalObject__addGc(JSC__JSGlobalObject* globalObject) // ====================== end conditional builtin globals ====================== -extern "C" bool JSC__JSGlobalObject__startRemoteInspector(JSC__JSGlobalObject* globalObject, unsigned char* host, uint16_t arg1) -{ -#if !ENABLE(REMOTE_INSPECTOR) - return false; -#else - globalObject->setInspectable(true); - auto& server = Inspector::RemoteInspectorServer::singleton(); - return server.start(reinterpret_cast(host), arg1); -#endif -} - void GlobalObject::drainMicrotasks() { auto& vm = this->vm(); @@ -4061,9 +3828,9 @@ extern "C" void JSGlobalObject__clearTerminationException(JSC::JSGlobalObject* g } } -extern "C" void Bun__queueTask(JSC__JSGlobalObject*, WebCore::EventLoopTask* task); -extern "C" void Bun__queueTaskWithTimeout(JSC__JSGlobalObject*, WebCore::EventLoopTask* task, int timeout); -extern "C" void Bun__queueTaskConcurrently(JSC__JSGlobalObject*, WebCore::EventLoopTask* task); +extern "C" void Bun__queueTask(JSC::JSGlobalObject*, WebCore::EventLoopTask* task); +extern "C" void Bun__queueTaskWithTimeout(JSC::JSGlobalObject*, WebCore::EventLoopTask* task, int timeout); +extern "C" void Bun__queueTaskConcurrently(JSC::JSGlobalObject*, WebCore::EventLoopTask* task); extern "C" void Bun__performTask(Zig::GlobalObject* globalObject, WebCore::EventLoopTask* task) { task->performTask(*globalObject->scriptExecutionContext()); @@ -4189,7 +3956,7 @@ void GlobalObject::reload() } } -extern "C" void JSC__JSGlobalObject__reload(JSC__JSGlobalObject* arg0) +extern "C" void JSC__JSGlobalObject__reload(JSC::JSGlobalObject* arg0) { Zig::GlobalObject* globalObject = reinterpret_cast(arg0); globalObject->reload(); diff --git a/src/bun.js/bindings/ZigGlobalObject.h b/src/bun.js/bindings/ZigGlobalObject.h index ad0b686123..e2c4cc90cc 100644 --- a/src/bun.js/bindings/ZigGlobalObject.h +++ b/src/bun.js/bindings/ZigGlobalObject.h @@ -70,8 +70,8 @@ class SubtleCrypto; class EventTarget; } -extern "C" void Bun__reportError(JSC__JSGlobalObject*, JSC__JSValue); -extern "C" void Bun__reportUnhandledError(JSC__JSGlobalObject*, JSC::EncodedJSValue); +extern "C" void Bun__reportError(JSC::JSGlobalObject*, JSC::EncodedJSValue); +extern "C" void Bun__reportUnhandledError(JSC::JSGlobalObject*, JSC::EncodedJSValue); extern "C" bool Bun__VirtualMachine__isShuttingDown(void* /* BunVM */); @@ -373,9 +373,9 @@ public: }; static constexpr size_t promiseFunctionsSize = 34; - static PromiseFunctions promiseHandlerID(SYSV_ABI EncodedJSValue (*handler)(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1)); + static PromiseFunctions promiseHandlerID(SYSV_ABI EncodedJSValue (*handler)(JSC::JSGlobalObject* arg0, JSC::CallFrame* arg1)); - JSFunction* thenable(SYSV_ABI EncodedJSValue (*handler)(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1)) + JSFunction* thenable(SYSV_ABI EncodedJSValue (*handler)(JSC::JSGlobalObject* arg0, JSC::CallFrame* arg1)) { auto& barrier = this->m_thenables[static_cast(GlobalObject::promiseHandlerID(handler))]; if (JSFunction* func = barrier.get()) { diff --git a/src/bun.js/bindings/bindings.cpp b/src/bun.js/bindings/bindings.cpp index 5338fc3c31..2d53c70739 100644 --- a/src/bun.js/bindings/bindings.cpp +++ b/src/bun.js/bindings/bindings.cpp @@ -168,7 +168,7 @@ static constexpr int FLAG_NOT = (1 << 2); #pragma clang diagnostic pop -extern "C" bool ExpectCustomAsymmetricMatcher__execute(void* self, JSC__JSValue thisValue, JSC__JSGlobalObject* globalObject, JSC__JSValue leftValue); +extern "C" bool ExpectCustomAsymmetricMatcher__execute(void* self, JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue leftValue); enum class AsymmetricMatcherResult : uint8_t { PASS, @@ -196,9 +196,9 @@ enum class AsymmetricMatcherConstructorType : int8_t { #define ASSERT_NO_PENDING_EXCEPTION(globalObject) void() #endif -extern "C" bool Expect_readFlagsAndProcessPromise(JSC__JSValue instanceValue, JSC__JSGlobalObject* globalObject, ExpectFlags* flags, JSC__JSValue* value, AsymmetricMatcherConstructorType* constructorType); +extern "C" bool Expect_readFlagsAndProcessPromise(JSC::EncodedJSValue instanceValue, JSC::JSGlobalObject* globalObject, ExpectFlags* flags, JSC::EncodedJSValue* value, AsymmetricMatcherConstructorType* constructorType); -extern "C" int8_t AsymmetricMatcherConstructorType__fromJS(JSC__JSGlobalObject* globalObject, JSC__JSValue encodedValue) +extern "C" int8_t AsymmetricMatcherConstructorType__fromJS(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue encodedValue) { JSValue value = JSValue::decode(encodedValue); if (value.isObject()) { @@ -544,7 +544,7 @@ AsymmetricMatcherResult matchAsymmetricMatcher(JSGlobalObject* globalObject, JSV } template -static void handlePromise(PromiseType* promise, JSC__JSGlobalObject* globalObject, JSC::EncodedJSValue ctx, Zig::FFIFunction resolverFunction, Zig::FFIFunction rejecterFunction) +static void handlePromise(PromiseType* promise, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue ctx, Zig::FFIFunction resolverFunction, Zig::FFIFunction rejecterFunction) { auto globalThis = reinterpret_cast(globalObject); @@ -608,10 +608,10 @@ JSValue getIndexWithoutAccessors(JSGlobalObject* globalObject, JSObject* obj, ui } template -std::optional specialObjectsDequal(JSC__JSGlobalObject* globalObject, MarkedArgumentBuffer& gcBuffer, Vector, 16>& stack, ThrowScope* scope, JSCell* _Nonnull c1, JSCell* _Nonnull c2); +std::optional specialObjectsDequal(JSC::JSGlobalObject* globalObject, MarkedArgumentBuffer& gcBuffer, Vector, 16>& stack, ThrowScope* scope, JSCell* _Nonnull c1, JSCell* _Nonnull c2); template -bool Bun__deepEquals(JSC__JSGlobalObject* globalObject, JSValue v1, JSValue v2, MarkedArgumentBuffer& gcBuffer, Vector, 16>& stack, ThrowScope* scope, bool addToStack) +bool Bun__deepEquals(JSC::JSGlobalObject* globalObject, JSValue v1, JSValue v2, MarkedArgumentBuffer& gcBuffer, Vector, 16>& stack, ThrowScope* scope, bool addToStack) { VM& vm = globalObject->vm(); if (UNLIKELY(!vm.isSafeToRecurse())) { @@ -981,7 +981,7 @@ bool Bun__deepEquals(JSC__JSGlobalObject* globalObject, JSValue v1, JSValue v2, } template -std::optional specialObjectsDequal(JSC__JSGlobalObject* globalObject, MarkedArgumentBuffer& gcBuffer, Vector, 16>& stack, ThrowScope* scope, JSCell* _Nonnull c1, JSCell* _Nonnull c2) +std::optional specialObjectsDequal(JSC::JSGlobalObject* globalObject, MarkedArgumentBuffer& gcBuffer, Vector, 16>& stack, ThrowScope* scope, JSCell* _Nonnull c1, JSCell* _Nonnull c2) { uint8_t c1Type = c1->type(); uint8_t c2Type = c2->type(); @@ -1641,7 +1641,7 @@ bool Bun__deepMatch( // anonymous namespace to avoid name collision namespace { template -inline bool deepEqualsWrapperImpl(JSC__JSValue a, JSC__JSValue b, JSC__JSGlobalObject* global) +inline bool deepEqualsWrapperImpl(JSC::EncodedJSValue a, JSC::EncodedJSValue b, JSC::JSGlobalObject* global) { auto& vm = global->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -1653,30 +1653,30 @@ inline bool deepEqualsWrapperImpl(JSC__JSValue a, JSC__JSValue b, JSC__JSGlobalO extern "C" { -bool WebCore__FetchHeaders__isEmpty(WebCore__FetchHeaders* arg0) +bool WebCore__FetchHeaders__isEmpty(WebCore::FetchHeaders* arg0) { return arg0->size() == 0; } -WebCore__FetchHeaders* WebCore__FetchHeaders__createEmpty() +WebCore::FetchHeaders* WebCore__FetchHeaders__createEmpty() { auto* headers = new WebCore::FetchHeaders({ WebCore::FetchHeaders::Guard::None, {} }); headers->relaxAdoptionRequirement(); return headers; } -void WebCore__FetchHeaders__append(WebCore__FetchHeaders* headers, const ZigString* arg1, const ZigString* arg2, - JSC__JSGlobalObject* lexicalGlobalObject) +void WebCore__FetchHeaders__append(WebCore::FetchHeaders* headers, const ZigString* arg1, const ZigString* arg2, + JSC::JSGlobalObject* lexicalGlobalObject) { auto throwScope = DECLARE_THROW_SCOPE(lexicalGlobalObject->vm()); WebCore::propagateException(*lexicalGlobalObject, throwScope, headers->append(Zig::toString(*arg1), Zig::toString(*arg2))); } -WebCore__FetchHeaders* WebCore__FetchHeaders__cast_(JSC__JSValue JSValue0, JSC__VM* vm) +WebCore::FetchHeaders* WebCore__FetchHeaders__cast_(JSC::EncodedJSValue JSValue0, JSC::VM* vm) { - return WebCoreCast(JSValue0); + return WebCoreCast(JSValue0); } -WebCore__FetchHeaders* WebCore__FetchHeaders__createFromJS(JSC__JSGlobalObject* lexicalGlobalObject, JSC__JSValue argument0_) +WebCore::FetchHeaders* WebCore__FetchHeaders__createFromJS(JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue argument0_) { EnsureStillAliveScope argument0 = JSC::JSValue::decode(argument0_); @@ -1731,7 +1731,7 @@ WebCore__FetchHeaders* WebCore__FetchHeaders__createFromJS(JSC__JSGlobalObject* return headers; } -JSC__JSValue WebCore__FetchHeaders__toJS(WebCore__FetchHeaders* headers, JSC__JSGlobalObject* lexicalGlobalObject) +JSC::EncodedJSValue WebCore__FetchHeaders__toJS(WebCore::FetchHeaders* headers, JSC::JSGlobalObject* lexicalGlobalObject) { Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); ASSERT_NO_PENDING_EXCEPTION(globalObject); @@ -1748,7 +1748,7 @@ JSC__JSValue WebCore__FetchHeaders__toJS(WebCore__FetchHeaders* headers, JSC__JS return JSC::JSValue::encode(value); } -JSC__JSValue WebCore__FetchHeaders__clone(WebCore__FetchHeaders* headers, JSC__JSGlobalObject* arg1) +JSC::EncodedJSValue WebCore__FetchHeaders__clone(WebCore::FetchHeaders* headers, JSC::JSGlobalObject* arg1) { auto throwScope = DECLARE_THROW_SCOPE(arg1->vm()); Zig::GlobalObject* globalObject = reinterpret_cast(arg1); @@ -1758,7 +1758,7 @@ JSC__JSValue WebCore__FetchHeaders__clone(WebCore__FetchHeaders* headers, JSC__J return JSC::JSValue::encode(WebCore::toJSNewlyCreated(arg1, globalObject, WTFMove(clone))); } -WebCore__FetchHeaders* WebCore__FetchHeaders__cloneThis(WebCore__FetchHeaders* headers, JSC__JSGlobalObject* lexicalGlobalObject) +WebCore::FetchHeaders* WebCore__FetchHeaders__cloneThis(WebCore::FetchHeaders* headers, JSC::JSGlobalObject* lexicalGlobalObject) { auto throwScope = DECLARE_THROW_SCOPE(lexicalGlobalObject->vm()); auto* clone = new WebCore::FetchHeaders({ WebCore::FetchHeaders::Guard::None, {} }); @@ -1768,12 +1768,12 @@ WebCore__FetchHeaders* WebCore__FetchHeaders__cloneThis(WebCore__FetchHeaders* h return clone; } -bool WebCore__FetchHeaders__fastHas_(WebCore__FetchHeaders* arg0, unsigned char HTTPHeaderName1) +bool WebCore__FetchHeaders__fastHas_(WebCore::FetchHeaders* arg0, unsigned char HTTPHeaderName1) { return arg0->fastHas(static_cast(HTTPHeaderName1)); } -void WebCore__FetchHeaders__copyTo(WebCore__FetchHeaders* headers, StringPointer* names, StringPointer* values, unsigned char* buf) +void WebCore__FetchHeaders__copyTo(WebCore::FetchHeaders* headers, StringPointer* names, StringPointer* values, unsigned char* buf) { auto iter = headers->createIterator(); unsigned int i = 0; @@ -1819,7 +1819,7 @@ void WebCore__FetchHeaders__copyTo(WebCore__FetchHeaders* headers, StringPointer values++; } } -void WebCore__FetchHeaders__count(WebCore__FetchHeaders* headers, uint32_t* count, uint32_t* buf_len) +void WebCore__FetchHeaders__count(WebCore::FetchHeaders* headers, uint32_t* count, uint32_t* buf_len) { auto iter = headers->createIterator(); size_t i = 0; @@ -1918,12 +1918,12 @@ WebCore::FetchHeaders* WebCore__FetchHeaders__createFromUWS(void* arg1) headers->setInternalHeaders(WTFMove(map)); return headers; } -void WebCore__FetchHeaders__deref(WebCore__FetchHeaders* arg0) +void WebCore__FetchHeaders__deref(WebCore::FetchHeaders* arg0) { arg0->deref(); } -JSC__JSValue WebCore__FetchHeaders__createValue(JSC__JSGlobalObject* arg0, StringPointer* arg1, StringPointer* arg2, const ZigString* arg3, uint32_t count) +JSC::EncodedJSValue WebCore__FetchHeaders__createValue(JSC::JSGlobalObject* arg0, StringPointer* arg1, StringPointer* arg2, const ZigString* arg3, uint32_t count) { auto throwScope = DECLARE_THROW_SCOPE(arg0->vm()); Vector> pairs; @@ -1945,7 +1945,7 @@ JSC__JSValue WebCore__FetchHeaders__createValue(JSC__JSGlobalObject* arg0, Strin fetchHeaders->computeMemoryCost(); return JSC::JSValue::encode(value); } -void WebCore__FetchHeaders__get_(WebCore__FetchHeaders* headers, const ZigString* arg1, ZigString* arg2, JSC__JSGlobalObject* global) +void WebCore__FetchHeaders__get_(WebCore::FetchHeaders* headers, const ZigString* arg1, ZigString* arg2, JSC::JSGlobalObject* global) { auto throwScope = DECLARE_THROW_SCOPE(global->vm()); auto result = headers->get(Zig::toString(*arg1)); @@ -1954,7 +1954,7 @@ void WebCore__FetchHeaders__get_(WebCore__FetchHeaders* headers, const ZigString else *arg2 = Zig::toZigString(result.releaseReturnValue()); } -bool WebCore__FetchHeaders__has(WebCore__FetchHeaders* headers, const ZigString* arg1, JSC__JSGlobalObject* global) +bool WebCore__FetchHeaders__has(WebCore::FetchHeaders* headers, const ZigString* arg1, JSC::JSGlobalObject* global) { auto throwScope = DECLARE_THROW_SCOPE(global->vm()); auto result = headers->has(Zig::toString(*arg1)); @@ -1964,26 +1964,26 @@ bool WebCore__FetchHeaders__has(WebCore__FetchHeaders* headers, const ZigString* } else return result.releaseReturnValue(); } -extern "C" void WebCore__FetchHeaders__put(WebCore__FetchHeaders* headers, HTTPHeaderName name, const ZigString* arg2, JSC__JSGlobalObject* global) +extern "C" void WebCore__FetchHeaders__put(WebCore::FetchHeaders* headers, HTTPHeaderName name, const ZigString* arg2, JSC::JSGlobalObject* global) { auto throwScope = DECLARE_THROW_SCOPE(global->vm()); throwScope.assertNoException(); // can't throw an exception when there's already one. WebCore::propagateException(*global, throwScope, headers->set(name, Zig::toStringCopy(*arg2))); } -void WebCore__FetchHeaders__remove(WebCore__FetchHeaders* headers, const ZigString* arg1, JSC__JSGlobalObject* global) +void WebCore__FetchHeaders__remove(WebCore::FetchHeaders* headers, const ZigString* arg1, JSC::JSGlobalObject* global) { auto throwScope = DECLARE_THROW_SCOPE(global->vm()); WebCore::propagateException(*global, throwScope, headers->remove(Zig::toString(*arg1))); } -void WebCore__FetchHeaders__fastRemove_(WebCore__FetchHeaders* headers, unsigned char headerName) +void WebCore__FetchHeaders__fastRemove_(WebCore::FetchHeaders* headers, unsigned char headerName) { headers->fastRemove(static_cast(headerName)); } -void WebCore__FetchHeaders__fastGet_(WebCore__FetchHeaders* headers, unsigned char headerName, ZigString* arg2) +void WebCore__FetchHeaders__fastGet_(WebCore::FetchHeaders* headers, unsigned char headerName, ZigString* arg2) { auto str = headers->fastGet(static_cast(headerName)); if (!str) { @@ -1993,24 +1993,24 @@ void WebCore__FetchHeaders__fastGet_(WebCore__FetchHeaders* headers, unsigned ch *arg2 = Zig::toZigString(str); } -WebCore__DOMURL* WebCore__DOMURL__cast_(JSC__JSValue JSValue0, JSC::VM* vm) +WebCore::DOMURL* WebCore__DOMURL__cast_(JSC::EncodedJSValue JSValue0, JSC::VM* vm) { - return WebCoreCast(JSValue0); + return WebCoreCast(JSValue0); } -void WebCore__DOMURL__href_(WebCore__DOMURL* domURL, ZigString* arg1) +void WebCore__DOMURL__href_(WebCore::DOMURL* domURL, ZigString* arg1) { const WTF::URL& href = domURL->href(); *arg1 = Zig::toZigString(href.string()); } -void WebCore__DOMURL__pathname_(WebCore__DOMURL* domURL, ZigString* arg1) +void WebCore__DOMURL__pathname_(WebCore::DOMURL* domURL, ZigString* arg1) { const WTF::URL& href = domURL->href(); const WTF::StringView& pathname = href.path(); *arg1 = Zig::toZigString(pathname); } -BunString WebCore__DOMURL__fileSystemPath(WebCore__DOMURL* arg0, int* errorCode) +BunString WebCore__DOMURL__fileSystemPath(WebCore::DOMURL* arg0, int* errorCode) { const WTF::URL& url = arg0->href(); if (url.protocolIsFile()) { @@ -2036,7 +2036,7 @@ BunString WebCore__DOMURL__fileSystemPath(WebCore__DOMURL* arg0, int* errorCode) return BunString { BunStringTag::Dead, nullptr }; } -extern "C" JSC__JSValue ZigString__toJSONObject(const ZigString* strPtr, JSC::JSGlobalObject* globalObject) +extern "C" JSC::EncodedJSValue ZigString__toJSONObject(const ZigString* strPtr, JSC::JSGlobalObject* globalObject) { ASSERT_NO_PENDING_EXCEPTION(globalObject); auto str = Zig::toString(*strPtr); @@ -2083,8 +2083,8 @@ JSC::EncodedJSValue JSGlobalObject__createOutOfMemoryError(JSC::JSGlobalObject* return JSValue::encode(exception); } -JSC__JSValue SystemError__toErrorInstance(const SystemError* arg0, - JSC__JSGlobalObject* globalObject) +JSC::EncodedJSValue SystemError__toErrorInstance(const SystemError* arg0, + JSC::JSGlobalObject* globalObject) { ASSERT_NO_PENDING_EXCEPTION(globalObject); SystemError err = *arg0; @@ -2147,8 +2147,8 @@ JSC__JSValue SystemError__toErrorInstance(const SystemError* arg0, return JSC::JSValue::encode(JSC::JSValue(result)); } -JSC__JSValue SystemError__toErrorInstanceWithInfoObject(const SystemError* arg0, - JSC__JSGlobalObject* globalObject) +JSC::EncodedJSValue SystemError__toErrorInstanceWithInfoObject(const SystemError* arg0, + JSC::JSGlobalObject* globalObject) { ASSERT_NO_PENDING_EXCEPTION(globalObject); SystemError err = *arg0; @@ -2201,9 +2201,9 @@ JSC__JSValue SystemError__toErrorInstanceWithInfoObject(const SystemError* arg0, RELEASE_AND_RETURN(scope, JSC::JSValue::encode(JSC::JSValue(result))); } -JSC__JSValue -JSC__JSObject__create(JSC__JSGlobalObject* globalObject, size_t initialCapacity, void* arg2, - void (*ArgFn3)(void* arg0, JSC__JSObject* arg1, JSC__JSGlobalObject* arg2)) +JSC::EncodedJSValue +JSC__JSObject__create(JSC::JSGlobalObject* globalObject, size_t initialCapacity, void* arg2, + void (*ArgFn3)(void* arg0, JSC::JSObject* arg1, JSC::JSGlobalObject* arg2)) { JSC::JSObject* object = JSC::constructEmptyObject(globalObject, globalObject->objectPrototype(), std::min(static_cast(initialCapacity), JSFinalObject::maxInlineCapacity)); @@ -2212,7 +2212,7 @@ JSC__JSObject__create(JSC__JSGlobalObject* globalObject, size_t initialCapacity, return JSC::JSValue::encode(object); } -bool JSC__JSValue__hasOwnPropertyValue(JSC__JSValue value, JSC__JSGlobalObject* globalObject, JSC__JSValue ownKey) +bool JSC__JSValue__hasOwnPropertyValue(JSC::EncodedJSValue value, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue ownKey) { auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); auto* object = JSC::jsCast(JSC::JSValue::decode(value)); @@ -2225,13 +2225,13 @@ bool JSC__JSValue__hasOwnPropertyValue(JSC__JSValue value, JSC__JSGlobalObject* return result; } -JSC__JSValue JSC__JSValue__createEmptyObjectWithNullPrototype(JSC__JSGlobalObject* globalObject) +JSC::EncodedJSValue JSC__JSValue__createEmptyObjectWithNullPrototype(JSC::JSGlobalObject* globalObject) { return JSValue::encode( JSC::constructEmptyObject(globalObject->vm(), globalObject->nullPrototypeObjectStructure())); } -JSC__JSValue JSC__JSValue__createEmptyObject(JSC__JSGlobalObject* globalObject, +JSC::EncodedJSValue JSC__JSValue__createEmptyObject(JSC::JSGlobalObject* globalObject, size_t initialCapacity) { return JSC::JSValue::encode( @@ -2240,7 +2240,7 @@ JSC__JSValue JSC__JSValue__createEmptyObject(JSC__JSGlobalObject* globalObject, extern "C" uint64_t Bun__Blob__getSizeForBindings(void* blob); -double JSC__JSValue__getLengthIfPropertyExistsInternal(JSC__JSValue value, JSC__JSGlobalObject* globalObject) +double JSC__JSValue__getLengthIfPropertyExistsInternal(JSC::EncodedJSValue value, JSC::JSGlobalObject* globalObject) { JSC::JSValue jsValue = JSC::JSValue::decode(value); if (!jsValue || !jsValue.isCell()) @@ -2313,7 +2313,7 @@ double JSC__JSValue__getLengthIfPropertyExistsInternal(JSC__JSValue value, JSC__ return std::numeric_limits::infinity(); } -void JSC__JSObject__putRecord(JSC__JSObject* object, JSC__JSGlobalObject* global, ZigString* key, +void JSC__JSObject__putRecord(JSC::JSObject* object, JSC::JSGlobalObject* global, ZigString* key, ZigString* values, size_t valuesLen) { auto scope = DECLARE_THROW_SCOPE(global->vm()); @@ -2355,7 +2355,7 @@ void JSC__JSObject__putRecord(JSC__JSObject* object, JSC__JSGlobalObject* global object->putDirect(global->vm(), ident, descriptor.value()); scope.release(); } -void JSC__JSValue__putRecord(JSC__JSValue objectValue, JSC__JSGlobalObject* global, ZigString* key, +void JSC__JSValue__putRecord(JSC::EncodedJSValue objectValue, JSC::JSGlobalObject* global, ZigString* key, ZigString* values, size_t valuesLen) { JSC::JSValue objValue = JSC::JSValue::decode(objectValue); @@ -2400,33 +2400,33 @@ void JSC__JSValue__putRecord(JSC__JSValue objectValue, JSC__JSGlobalObject* glob scope.release(); } -JSC__JSInternalPromise* JSC__JSValue__asInternalPromise(JSC__JSValue JSValue0) +JSC::JSInternalPromise* JSC__JSValue__asInternalPromise(JSC::EncodedJSValue JSValue0) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); return JSC::jsDynamicCast(value); } -JSC__JSPromise* JSC__JSValue__asPromise(JSC__JSValue JSValue0) +JSC::JSPromise* JSC__JSValue__asPromise(JSC::EncodedJSValue JSValue0) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); return JSC::jsDynamicCast(value); } -JSC__JSValue JSC__JSValue__createInternalPromise(JSC__JSGlobalObject* globalObject) +JSC::EncodedJSValue JSC__JSValue__createInternalPromise(JSC::JSGlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); return JSC::JSValue::encode( JSC::JSValue(JSC::JSInternalPromise::create(vm, globalObject->internalPromiseStructure()))); } -void JSC__JSFunction__optimizeSoon(JSC__JSValue JSValue0) +void JSC__JSFunction__optimizeSoon(JSC::EncodedJSValue JSValue0) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); JSC::optimizeNextInvocation(value); } -bool JSC__JSFunction__getSourceCode(JSC__JSValue JSValue0, ZigString* outSourceCode) +bool JSC__JSFunction__getSourceCode(JSC::EncodedJSValue JSValue0, ZigString* outSourceCode) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); if (JSC::JSFunction* func = jsDynamicCast(value)) { @@ -2441,7 +2441,7 @@ bool JSC__JSFunction__getSourceCode(JSC__JSValue JSValue0, ZigString* outSourceC return false; } -void JSC__JSValue__jsonStringify(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, uint32_t arg2, +void JSC__JSValue__jsonStringify(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, uint32_t arg2, BunString* arg3) { ASSERT_NO_PENDING_EXCEPTION(arg1); @@ -2449,7 +2449,7 @@ void JSC__JSValue__jsonStringify(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg WTF::String str = JSC::JSONStringify(arg1, value, (unsigned)arg2); *arg3 = Bun::toStringRef(str); } -unsigned char JSC__JSValue__jsType(JSC__JSValue JSValue0) +unsigned char JSC__JSValue__jsType(JSC::EncodedJSValue JSValue0) { JSC::JSValue jsValue = JSC::JSValue::decode(JSValue0); // if the value is NOT a cell @@ -2460,13 +2460,13 @@ unsigned char JSC__JSValue__jsType(JSC__JSValue JSValue0) return 0; } -CPP_DECL JSC__JSString* JSC__jsTypeStringForValue(JSC__JSGlobalObject* globalObject, JSC__JSValue value) +CPP_DECL JSC::JSString* JSC__jsTypeStringForValue(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) { JSC::JSValue jsValue = JSC::JSValue::decode(value); return jsTypeStringForValue(globalObject, jsValue); } -JSC__JSValue JSC__JSPromise__asValue(JSC__JSPromise* arg0, JSC__JSGlobalObject* arg1) +JSC::EncodedJSValue JSC__JSPromise__asValue(JSC::JSPromise* arg0, JSC::JSGlobalObject* arg1) { JSValue value = JSC::JSValue(arg0); ASSERT_WITH_MESSAGE(!value.isEmpty(), "JSPromise.asValue() called on a empty JSValue"); @@ -2474,13 +2474,13 @@ JSC__JSValue JSC__JSPromise__asValue(JSC__JSPromise* arg0, JSC__JSGlobalObject* return JSC::JSValue::encode(value); } -JSC__JSPromise* JSC__JSPromise__create(JSC__JSGlobalObject* arg0) +JSC::JSPromise* JSC__JSPromise__create(JSC::JSGlobalObject* arg0) { return JSC::JSPromise::create(arg0->vm(), arg0->promiseStructure()); } // TODO: prevent this from allocating so much memory -void JSC__JSValue___then(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, JSC__JSValue arg2, Zig::FFIFunction ArgFn3, Zig::FFIFunction ArgFn4) +void JSC__JSValue___then(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue arg2, Zig::FFIFunction ArgFn3, Zig::FFIFunction ArgFn4) { auto* cell = JSC::JSValue::decode(JSValue0).asCell(); @@ -2492,7 +2492,7 @@ void JSC__JSValue___then(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, JSC__ } } -JSC__JSValue JSC__JSGlobalObject__getCachedObject(JSC__JSGlobalObject* globalObject, const ZigString* arg1) +JSC::EncodedJSValue JSC__JSGlobalObject__getCachedObject(JSC::JSGlobalObject* globalObject, const ZigString* arg1) { auto& vm = JSC::getVM(globalObject); WTF::String string = Zig::toString(*arg1); @@ -2502,7 +2502,7 @@ JSC__JSValue JSC__JSGlobalObject__getCachedObject(JSC__JSGlobalObject* globalObj return JSC::JSValue::encode(result); } -JSC__JSValue JSC__JSGlobalObject__putCachedObject(JSC__JSGlobalObject* globalObject, const ZigString* arg1, JSC__JSValue JSValue2) +JSC::EncodedJSValue JSC__JSGlobalObject__putCachedObject(JSC::JSGlobalObject* globalObject, const ZigString* arg1, JSC::EncodedJSValue JSValue2) { auto& vm = JSC::getVM(globalObject); WTF::String string = Zig::toString(*arg1); @@ -2512,7 +2512,7 @@ JSC__JSValue JSC__JSGlobalObject__putCachedObject(JSC__JSGlobalObject* globalObj return JSValue2; } -void JSC__JSGlobalObject__deleteModuleRegistryEntry(JSC__JSGlobalObject* global, ZigString* arg1) +void JSC__JSGlobalObject__deleteModuleRegistryEntry(JSC::JSGlobalObject* global, ZigString* arg1) { JSC::JSMap* map = JSC::jsDynamicCast( global->moduleLoader()->getDirect(global->vm(), JSC::Identifier::fromString(global->vm(), "registry"_s))); @@ -2524,48 +2524,48 @@ void JSC__JSGlobalObject__deleteModuleRegistryEntry(JSC__JSGlobalObject* global, map->remove(global, val); } -void JSC__VM__collectAsync(JSC__VM* vm) +void JSC__VM__collectAsync(JSC::VM* vm) { JSC::JSLockHolder lock(*vm); vm->heap.collectAsync(); } -size_t JSC__VM__heapSize(JSC__VM* arg0) +size_t JSC__VM__heapSize(JSC::VM* arg0) { return arg0->heap.size(); } -bool JSC__JSValue__isSameValue(JSC__JSValue JSValue0, JSC__JSValue JSValue1, - JSC__JSGlobalObject* globalObject) +bool JSC__JSValue__isSameValue(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, + JSC::JSGlobalObject* globalObject) { JSC::JSValue left = JSC::JSValue::decode(JSValue0); JSC::JSValue right = JSC::JSValue::decode(JSValue1); return JSC::sameValue(globalObject, left, right); } -bool JSC__JSValue__deepEquals(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* globalObject) +bool JSC__JSValue__deepEquals(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* globalObject) { return deepEqualsWrapperImpl(JSValue0, JSValue1, globalObject); } -bool JSC__JSValue__jestDeepEquals(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* globalObject) +bool JSC__JSValue__jestDeepEquals(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* globalObject) { return deepEqualsWrapperImpl(JSValue0, JSValue1, globalObject); } -bool JSC__JSValue__strictDeepEquals(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* globalObject) +bool JSC__JSValue__strictDeepEquals(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* globalObject) { return deepEqualsWrapperImpl(JSValue0, JSValue1, globalObject); } -bool JSC__JSValue__jestStrictDeepEquals(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* globalObject) +bool JSC__JSValue__jestStrictDeepEquals(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* globalObject) { return deepEqualsWrapperImpl(JSValue0, JSValue1, globalObject); } #undef IMPL_DEEP_EQUALS_WRAPPER -bool JSC__JSValue__deepMatch(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* globalObject, bool replacePropsWithAsymmetricMatchers) +bool JSC__JSValue__deepMatch(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* globalObject, bool replacePropsWithAsymmetricMatchers) { JSValue obj = JSValue::decode(JSValue0); JSValue subset = JSValue::decode(JSValue1); @@ -2578,7 +2578,7 @@ bool JSC__JSValue__deepMatch(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__ return Bun__deepMatch(obj, &objVisited, subset, &subsetVisited, globalObject, &scope, &gcBuffer, replacePropsWithAsymmetricMatchers, false); } -bool JSC__JSValue__jestDeepMatch(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* globalObject, bool replacePropsWithAsymmetricMatchers) +bool JSC__JSValue__jestDeepMatch(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* globalObject, bool replacePropsWithAsymmetricMatchers) { JSValue obj = JSValue::decode(JSValue0); JSValue subset = JSValue::decode(JSValue1); @@ -2591,13 +2591,13 @@ bool JSC__JSValue__jestDeepMatch(JSC__JSValue JSValue0, JSC__JSValue JSValue1, J return Bun__deepMatch(obj, &objVisited, subset, &subsetVisited, globalObject, &scope, &gcBuffer, replacePropsWithAsymmetricMatchers, false); } -extern "C" bool Bun__JSValue__isAsyncContextFrame(JSC__JSValue value) +extern "C" bool Bun__JSValue__isAsyncContextFrame(JSC::EncodedJSValue value) { return jsDynamicCast(JSValue::decode(value)) != nullptr; } -extern "C" JSC__JSValue Bun__JSValue__call(JSContextRef ctx, JSC__JSValue object, - JSC__JSValue thisObject, size_t argumentCount, +extern "C" JSC::EncodedJSValue Bun__JSValue__call(JSContextRef ctx, JSC::EncodedJSValue object, + JSC::EncodedJSValue thisObject, size_t argumentCount, const JSValueRef* arguments) { JSC::JSGlobalObject* globalObject = toJS(ctx); @@ -2644,7 +2644,7 @@ extern "C" JSC__JSValue Bun__JSValue__call(JSContextRef ctx, JSC__JSValue object return JSC::JSValue::encode(result); } -JSC__JSValue JSObjectCallAsFunctionReturnValueHoldingAPILock(JSContextRef ctx, JSObjectRef object, +JSC::EncodedJSValue JSObjectCallAsFunctionReturnValueHoldingAPILock(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef* arguments) @@ -2690,29 +2690,29 @@ JSC__JSValue JSObjectCallAsFunctionReturnValueHoldingAPILock(JSContextRef ctx, J // CPP_DECL const JSC__PropertyName* // JSC__PropertyNameArray__next(JSC__PropertyNameArray* arg0, size_t arg1); // CPP_DECL void JSC__PropertyNameArray__release(JSC__PropertyNameArray* arg0); -size_t JSC__JSObject__getArrayLength(JSC__JSObject* arg0) { return arg0->getArrayLength(); } +size_t JSC__JSObject__getArrayLength(JSC::JSObject* arg0) { return arg0->getArrayLength(); } -JSC__JSValue JSC__JSObject__getIndex(JSC__JSValue jsValue, JSC__JSGlobalObject* arg1, +JSC::EncodedJSValue JSC__JSObject__getIndex(JSC::EncodedJSValue jsValue, JSC::JSGlobalObject* arg1, uint32_t arg3) { ASSERT_NO_PENDING_EXCEPTION(arg1); return JSC::JSValue::encode(JSC::JSValue::decode(jsValue).toObject(arg1)->getIndex(arg1, arg3)); } -JSC__JSValue JSC__JSValue__getDirectIndex(JSC__JSValue jsValue, JSC__JSGlobalObject* arg1, +JSC::EncodedJSValue JSC__JSValue__getDirectIndex(JSC::EncodedJSValue jsValue, JSC::JSGlobalObject* arg1, uint32_t arg3) { JSC::JSObject* object = JSC::JSValue::decode(jsValue).getObject(); return JSC::JSValue::encode(object->getDirectIndex(arg1, arg3)); } -JSC__JSValue JSC__JSObject__getDirect(JSC__JSObject* arg0, JSC__JSGlobalObject* arg1, +JSC::EncodedJSValue JSC__JSObject__getDirect(JSC::JSObject* arg0, JSC::JSGlobalObject* arg1, const ZigString* arg2) { return JSC::JSValue::encode(arg0->getDirect(arg1->vm(), Zig::toIdentifier(*arg2, arg1))); } -void JSC__JSObject__putDirect(JSC__JSObject* arg0, JSC__JSGlobalObject* arg1, const ZigString* key, - JSC__JSValue value) +void JSC__JSObject__putDirect(JSC::JSObject* arg0, JSC::JSGlobalObject* arg1, const ZigString* key, + JSC::EncodedJSValue value) { auto prop = Zig::toIdentifier(*key, arg1); @@ -2721,20 +2721,20 @@ void JSC__JSObject__putDirect(JSC__JSObject* arg0, JSC__JSGlobalObject* arg1, co #pragma mark - JSC::JSCell -JSC__JSObject* JSC__JSCell__getObject(JSC__JSCell* arg0) +JSC::JSObject* JSC__JSCell__getObject(JSC::JSCell* arg0) { return arg0->getObject(); } -unsigned char JSC__JSCell__getType(JSC__JSCell* arg0) { return arg0->type(); } +unsigned char JSC__JSCell__getType(JSC::JSCell* arg0) { return arg0->type(); } -JSC__JSObject* JSC__JSCell__toObject(JSC__JSCell* cell, JSC__JSGlobalObject* globalObject) +JSC::JSObject* JSC__JSCell__toObject(JSC::JSCell* cell, JSC::JSGlobalObject* globalObject) { return cell->toObject(globalObject); } #pragma mark - JSC::JSString -void JSC__JSString__toZigString(JSC__JSString* arg0, JSC__JSGlobalObject* arg1, ZigString* arg2) +void JSC__JSString__toZigString(JSC::JSString* arg0, JSC::JSGlobalObject* arg1, ZigString* arg2) { auto value = arg0->value(arg1); *arg2 = Zig::toZigString(value.data.impl()); @@ -2742,23 +2742,23 @@ void JSC__JSString__toZigString(JSC__JSString* arg0, JSC__JSGlobalObject* arg1, // We don't need to assert here because ->value returns a reference to the same string as the one owned by the JSString. } -bool JSC__JSString__eql(const JSC__JSString* arg0, JSC__JSGlobalObject* obj, JSC__JSString* arg2) +bool JSC__JSString__eql(const JSC::JSString* arg0, JSC::JSGlobalObject* obj, JSC::JSString* arg2) { return arg0->equal(obj, arg2); } -bool JSC__JSString__is8Bit(const JSC__JSString* arg0) { return arg0->is8Bit(); }; -size_t JSC__JSString__length(const JSC__JSString* arg0) { return arg0->length(); } +bool JSC__JSString__is8Bit(const JSC::JSString* arg0) { return arg0->is8Bit(); }; +size_t JSC__JSString__length(const JSC::JSString* arg0) { return arg0->length(); } -JSC__JSObject* JSC__JSString__toObject(JSC__JSString* arg0, JSC__JSGlobalObject* arg1) +JSC::JSObject* JSC__JSString__toObject(JSC::JSString* arg0, JSC::JSGlobalObject* arg1) { return arg0->toObject(arg1); } #pragma mark - JSC::JSModuleLoader -// JSC__JSValue +// JSC::EncodedJSValue // JSC__JSModuleLoader__dependencyKeysIfEvaluated(JSC__JSModuleLoader* arg0, -// JSC__JSGlobalObject* arg1, JSC__JSModuleRecord* arg2) { +// JSC::JSGlobalObject* arg1, JSC__JSModuleRecord* arg2) { // arg2->depen // } extern "C" JSC::JSInternalPromise* JSModuleLoader__import(JSC::JSGlobalObject* globalObject, const BunString* moduleNameStr) @@ -2771,9 +2771,9 @@ extern "C" JSC::JSInternalPromise* JSModuleLoader__import(JSC::JSGlobalObject* g return promise; } -JSC__JSValue JSC__JSModuleLoader__evaluate(JSC__JSGlobalObject* globalObject, const unsigned char* arg1, +JSC::EncodedJSValue JSC__JSModuleLoader__evaluate(JSC::JSGlobalObject* globalObject, const unsigned char* arg1, size_t arg2, const unsigned char* originUrlPtr, size_t originURLLen, const unsigned char* referrerUrlPtr, size_t referrerUrlLen, - JSC__JSValue JSValue5, JSC__JSValue* arg6) + JSC::EncodedJSValue JSValue5, JSC::EncodedJSValue* arg6) { WTF::String src = WTF::String::fromUTF8(std::span { arg1, arg2 }).isolatedCopy(); WTF::URL origin = WTF::URL::fileURLWithFileSystemPath(WTF::String::fromUTF8(std::span { originUrlPtr, originURLLen })).isolatedCopy(); @@ -2813,7 +2813,7 @@ static JSC::Identifier jsValueToModuleKey(JSC::JSGlobalObject* lexicalGlobalObje return JSC::asString(value)->toIdentifier(lexicalGlobalObject); } -JSC__JSValue ReadableStream__empty(Zig::GlobalObject* globalObject) +JSC::EncodedJSValue ReadableStream__empty(Zig::GlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); auto clientData = WebCore::clientData(vm); @@ -2821,7 +2821,7 @@ JSC__JSValue ReadableStream__empty(Zig::GlobalObject* globalObject) return JSValue::encode(JSC::call(globalObject, function, JSC::ArgList(), "ReadableStream.create"_s)); } -JSC__JSValue ReadableStream__used(Zig::GlobalObject* globalObject) +JSC::EncodedJSValue ReadableStream__used(Zig::GlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); auto clientData = WebCore::clientData(vm); @@ -2829,8 +2829,8 @@ JSC__JSValue ReadableStream__used(Zig::GlobalObject* globalObject) return JSValue::encode(JSC::call(globalObject, function, JSC::ArgList(), "ReadableStream.create"_s)); } -JSC__JSValue JSC__JSValue__createRangeError(const ZigString* message, const ZigString* arg1, - JSC__JSGlobalObject* globalObject) +JSC::EncodedJSValue JSC__JSValue__createRangeError(const ZigString* message, const ZigString* arg1, + JSC::JSGlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); ZigString code = *arg1; @@ -2846,8 +2846,8 @@ JSC__JSValue JSC__JSValue__createRangeError(const ZigString* message, const ZigS return JSC::JSValue::encode(rangeError); } -JSC__JSValue JSC__JSValue__createTypeError(const ZigString* message, const ZigString* arg1, - JSC__JSGlobalObject* globalObject) +JSC::EncodedJSValue JSC__JSValue__createTypeError(const ZigString* message, const ZigString* arg1, + JSC::JSGlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); ZigString code = *arg1; @@ -2862,7 +2862,7 @@ JSC__JSValue JSC__JSValue__createTypeError(const ZigString* message, const ZigSt return JSC::JSValue::encode(typeError); } -JSC__JSValue JSC__JSValue__fromEntries(JSC__JSGlobalObject* globalObject, ZigString* keys, +JSC::EncodedJSValue JSC__JSValue__fromEntries(JSC::JSGlobalObject* globalObject, ZigString* keys, ZigString* values, size_t initialCapacity, bool clone) { auto& vm = JSC::getVM(globalObject); @@ -2893,7 +2893,7 @@ JSC__JSValue JSC__JSValue__fromEntries(JSC__JSGlobalObject* globalObject, ZigStr return JSC::JSValue::encode(object); } -JSC__JSValue JSC__JSValue__keys(JSC__JSGlobalObject* globalObject, JSC__JSValue objectValue) +JSC::EncodedJSValue JSC__JSValue__keys(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue objectValue) { auto& vm = JSC::getVM(globalObject); @@ -2905,7 +2905,7 @@ JSC__JSValue JSC__JSValue__keys(JSC__JSGlobalObject* globalObject, JSC__JSValue RELEASE_AND_RETURN(scope, JSValue::encode(ownPropertyKeys(globalObject, object, PropertyNameMode::Strings, DontEnumPropertiesMode::Exclude))); } -JSC__JSValue JSC__JSValue__values(JSC__JSGlobalObject* globalObject, JSC__JSValue objectValue) +JSC::EncodedJSValue JSC__JSValue__values(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue objectValue) { auto& vm = JSC::getVM(globalObject); JSValue value = JSValue::decode(objectValue); @@ -2913,7 +2913,7 @@ JSC__JSValue JSC__JSValue__values(JSC__JSGlobalObject* globalObject, JSC__JSValu return JSValue::encode(JSC::objectValues(vm, globalObject, value)); } -bool JSC__JSValue__asArrayBuffer_(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, +bool JSC__JSValue__asArrayBuffer_(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, Bun__ArrayBuffer* arg2) { ASSERT_NO_PENDING_EXCEPTION(arg1); @@ -2994,11 +2994,11 @@ bool JSC__JSValue__asArrayBuffer_(JSC__JSValue JSValue0, JSC__JSGlobalObject* ar return false; } -CPP_DECL JSC__JSValue JSC__JSValue__createEmptyArray(JSC__JSGlobalObject* arg0, size_t length) +CPP_DECL JSC::EncodedJSValue JSC__JSValue__createEmptyArray(JSC::JSGlobalObject* arg0, size_t length) { return JSC::JSValue::encode(JSC::constructEmptyArray(arg0, nullptr, length)); } -CPP_DECL void JSC__JSValue__putIndex(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, uint32_t arg2, JSC__JSValue JSValue3) +CPP_DECL void JSC__JSValue__putIndex(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, uint32_t arg2, JSC::EncodedJSValue JSValue3) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); JSC::JSValue value2 = JSC::JSValue::decode(JSValue3); @@ -3006,7 +3006,7 @@ CPP_DECL void JSC__JSValue__putIndex(JSC__JSValue JSValue0, JSC__JSGlobalObject* array->putDirectIndex(arg1, arg2, value2); } -CPP_DECL void JSC__JSValue__push(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue3) +CPP_DECL void JSC__JSValue__push(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue3) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); JSC::JSValue value2 = JSC::JSValue::decode(JSValue3); @@ -3014,7 +3014,7 @@ CPP_DECL void JSC__JSValue__push(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg array->push(arg1, value2); } -JSC__JSValue JSC__JSGlobalObject__createAggregateError(JSC__JSGlobalObject* globalObject, +JSC::EncodedJSValue JSC__JSGlobalObject__createAggregateError(JSC::JSGlobalObject* globalObject, const JSValue* errors, size_t errors_count, const ZigString* arg3) { @@ -3053,7 +3053,7 @@ JSC::EncodedJSValue JSC__JSGlobalObject__createAggregateErrorWithArray(JSC::JSGl return JSC::JSValue::encode(JSC::createAggregateError(global, vm, errorStructure, array, JSC::jsString(vm, messageString), options, nullptr, JSC::TypeNothing, false)); } -JSC__JSValue ZigString__toAtomicValue(const ZigString* arg0, JSC__JSGlobalObject* arg1) +JSC::EncodedJSValue ZigString__toAtomicValue(const ZigString* arg0, JSC::JSGlobalObject* arg1) { if (arg0->len == 0) { return JSC::JSValue::encode(JSC::jsEmptyString(arg1->vm())); @@ -3072,13 +3072,13 @@ JSC__JSValue ZigString__toAtomicValue(const ZigString* arg0, JSC__JSGlobalObject return JSC::JSValue::encode(JSC::JSValue(JSC::jsString(arg1->vm(), makeAtomString(Zig::toStringCopy(*arg0))))); } -JSC__JSValue ZigString__to16BitValue(const ZigString* arg0, JSC__JSGlobalObject* arg1) +JSC::EncodedJSValue ZigString__to16BitValue(const ZigString* arg0, JSC::JSGlobalObject* arg1) { auto str = WTF::String::fromUTF8(std::span { arg0->ptr, arg0->len }); return JSC::JSValue::encode(JSC::JSValue(JSC::jsString(arg1->vm(), str))); } -JSC__JSValue ZigString__toExternalU16(const uint16_t* arg0, size_t len, JSC__JSGlobalObject* global) +JSC::EncodedJSValue ZigString__toExternalU16(const uint16_t* arg0, size_t len, JSC::JSGlobalObject* global) { if (len == 0) { return JSC::JSValue::encode(JSC::jsEmptyString(global->vm())); @@ -3090,7 +3090,7 @@ JSC__JSValue ZigString__toExternalU16(const uint16_t* arg0, size_t len, JSC__JSG global->vm(), WTFMove(ref)))); } // This must be a globally allocated string -JSC__JSValue ZigString__toExternalValue(const ZigString* arg0, JSC__JSGlobalObject* arg1) +JSC::EncodedJSValue ZigString__toExternalValue(const ZigString* arg0, JSC::JSGlobalObject* arg1) { ZigString str = *arg0; @@ -3111,17 +3111,17 @@ JSC__JSValue ZigString__toExternalValue(const ZigString* arg0, JSC__JSGlobalObje } } -VirtualMachine* JSC__JSGlobalObject__bunVM(JSC__JSGlobalObject* arg0) +VirtualMachine* JSC__JSGlobalObject__bunVM(JSC::JSGlobalObject* arg0) { return reinterpret_cast(WebCore::clientData(arg0->vm())->bunVM); } -JSC__JSValue ZigString__toValueGC(const ZigString* arg0, JSC__JSGlobalObject* arg1) +JSC::EncodedJSValue ZigString__toValueGC(const ZigString* arg0, JSC::JSGlobalObject* arg1) { return JSC::JSValue::encode(JSC::JSValue(JSC::jsString(arg1->vm(), Zig::toStringCopy(*arg0)))); } -void JSC__JSValue__toZigString(JSC__JSValue JSValue0, ZigString* arg1, JSC__JSGlobalObject* arg2) +void JSC__JSValue__toZigString(JSC::EncodedJSValue JSValue0, ZigString* arg1, JSC::JSGlobalObject* arg2) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); @@ -3150,7 +3150,7 @@ void JSC__JSValue__toZigString(JSC__JSValue JSValue0, ZigString* arg1, JSC__JSGl arg1->len = str->length(); } -JSC__JSValue ZigString__external(const ZigString* arg0, JSC__JSGlobalObject* arg1, void* arg2, void (*ArgFn3)(void* arg0, void* arg1, size_t arg2)) +JSC::EncodedJSValue ZigString__external(const ZigString* arg0, JSC::JSGlobalObject* arg1, void* arg2, void (*ArgFn3)(void* arg0, void* arg1, size_t arg2)) { ZigString str = *arg0; @@ -3165,7 +3165,7 @@ JSC__JSValue ZigString__external(const ZigString* arg0, JSC__JSGlobalObject* arg } } -JSC__JSValue ZigString__toExternalValueWithCallback(const ZigString* arg0, JSC__JSGlobalObject* arg1, void (*ArgFn2)(void* arg2, void* arg0, size_t arg1)) +JSC::EncodedJSValue ZigString__toExternalValueWithCallback(const ZigString* arg0, JSC::JSGlobalObject* arg1, void (*ArgFn2)(void* arg2, void* arg0, size_t arg1)) { ZigString str @@ -3181,22 +3181,22 @@ JSC__JSValue ZigString__toExternalValueWithCallback(const ZigString* arg0, JSC__ } } -JSC__JSValue ZigString__toErrorInstance(const ZigString* str, JSC__JSGlobalObject* globalObject) +JSC::EncodedJSValue ZigString__toErrorInstance(const ZigString* str, JSC::JSGlobalObject* globalObject) { return JSC::JSValue::encode(Zig::getErrorInstance(str, globalObject)); } -JSC__JSValue ZigString__toTypeErrorInstance(const ZigString* str, JSC__JSGlobalObject* globalObject) +JSC::EncodedJSValue ZigString__toTypeErrorInstance(const ZigString* str, JSC::JSGlobalObject* globalObject) { return JSC::JSValue::encode(Zig::getTypeErrorInstance(str, globalObject)); } -JSC__JSValue ZigString__toSyntaxErrorInstance(const ZigString* str, JSC__JSGlobalObject* globalObject) +JSC::EncodedJSValue ZigString__toSyntaxErrorInstance(const ZigString* str, JSC::JSGlobalObject* globalObject) { return JSC::JSValue::encode(Zig::getSyntaxErrorInstance(str, globalObject)); } -JSC__JSValue ZigString__toRangeErrorInstance(const ZigString* str, JSC__JSGlobalObject* globalObject) +JSC::EncodedJSValue ZigString__toRangeErrorInstance(const ZigString* str, JSC::JSGlobalObject* globalObject) { return JSC::JSValue::encode(Zig::getRangeErrorInstance(str, globalObject)); } @@ -3207,8 +3207,8 @@ static JSC::EncodedJSValue resolverFunctionCallback(JSC::JSGlobalObject* globalO return JSC::JSValue::encode(JSC::jsUndefined()); } -JSC__JSInternalPromise* -JSC__JSModuleLoader__loadAndEvaluateModule(JSC__JSGlobalObject* globalObject, +JSC::JSInternalPromise* +JSC__JSModuleLoader__loadAndEvaluateModule(JSC::JSGlobalObject* globalObject, const BunString* arg1) { auto& vm = JSC::getVM(globalObject); @@ -3227,7 +3227,7 @@ JSC__JSModuleLoader__loadAndEvaluateModule(JSC__JSGlobalObject* globalObject, } #pragma mark - JSC::JSPromise -void JSC__AnyPromise__wrap(JSC__JSGlobalObject* globalObject, EncodedJSValue encodedPromise, void* ctx, JSC__JSValue (*func)(void*, JSC__JSGlobalObject*)) +void JSC__AnyPromise__wrap(JSC::JSGlobalObject* globalObject, EncodedJSValue encodedPromise, void* ctx, JSC::EncodedJSValue (*func)(void*, JSC::JSGlobalObject*)) { auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_CATCH_SCOPE(vm); @@ -3279,7 +3279,7 @@ void JSC__AnyPromise__wrap(JSC__JSGlobalObject* globalObject, EncodedJSValue enc ASSERT_NOT_REACHED_WITH_MESSAGE("Non-promise value passed to AnyPromise.wrap"); } -JSC__JSValue JSC__JSPromise__wrap(JSC__JSGlobalObject* globalObject, void* ctx, JSC__JSValue (*func)(void*, JSC__JSGlobalObject*)) +JSC::EncodedJSValue JSC__JSPromise__wrap(JSC::JSGlobalObject* globalObject, void* ctx, JSC::EncodedJSValue (*func)(void*, JSC::JSGlobalObject*)) { auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_CATCH_SCOPE(vm); @@ -3302,8 +3302,8 @@ JSC__JSValue JSC__JSPromise__wrap(JSC__JSGlobalObject* globalObject, void* ctx, return JSValue::encode(JSC::JSPromise::resolvedPromise(globalObject, result)); } -void JSC__JSPromise__reject(JSC__JSPromise* arg0, JSC__JSGlobalObject* globalObject, - JSC__JSValue JSValue2) +void JSC__JSPromise__reject(JSC::JSPromise* arg0, JSC::JSGlobalObject* globalObject, + JSC::EncodedJSValue JSValue2) { JSValue value = JSC::JSValue::decode(JSValue2); ASSERT_WITH_MESSAGE(!value.isEmpty(), "Promise.reject cannot be called with a empty JSValue"); @@ -3320,27 +3320,22 @@ void JSC__JSPromise__reject(JSC__JSPromise* arg0, JSC__JSGlobalObject* globalObj arg0->reject(globalObject, exception); } -void JSC__JSPromise__rejectAsHandled(JSC__JSPromise* arg0, JSC__JSGlobalObject* arg1, - JSC__JSValue JSValue2) +void JSC__JSPromise__rejectAsHandled(JSC::JSPromise* arg0, JSC::JSGlobalObject* arg1, + JSC::EncodedJSValue JSValue2) { ASSERT_WITH_MESSAGE(arg0->inherits(), "Argument is not a promise"); ASSERT_WITH_MESSAGE(arg0->status(arg0->vm()) == JSC::JSPromise::Status::Pending, "Promise is already resolved or rejected"); arg0->rejectAsHandled(arg1, JSC::JSValue::decode(JSValue2)); } -void JSC__JSPromise__rejectAsHandledException(JSC__JSPromise* arg0, JSC__JSGlobalObject* arg1, - JSC__Exception* arg2) -{ - arg0->rejectAsHandled(arg1, arg2); -} -JSC__JSPromise* JSC__JSPromise__rejectedPromise(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1) +JSC::JSPromise* JSC__JSPromise__rejectedPromise(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1) { return JSC::JSPromise::rejectedPromise(arg0, JSC::JSValue::decode(JSValue1)); } -void JSC__JSPromise__resolve(JSC__JSPromise* arg0, JSC__JSGlobalObject* arg1, - JSC__JSValue JSValue2) +void JSC__JSPromise__resolve(JSC::JSPromise* arg0, JSC::JSGlobalObject* arg1, + JSC::EncodedJSValue JSValue2) { JSValue target = JSValue::decode(JSValue2); @@ -3354,13 +3349,13 @@ void JSC__JSPromise__resolve(JSC__JSPromise* arg0, JSC__JSGlobalObject* arg1, } // This implementation closely mimics the one in JSC::JSPromise::resolve -void JSC__JSPromise__resolveOnNextTick(JSC__JSPromise* promise, JSC__JSGlobalObject* lexicalGlobalObject, - JSC__JSValue encoedValue) +void JSC__JSPromise__resolveOnNextTick(JSC::JSPromise* promise, JSC::JSGlobalObject* lexicalGlobalObject, + JSC::EncodedJSValue encoedValue) { return JSC__JSPromise__resolve(promise, lexicalGlobalObject, encoedValue); } -bool JSC__JSValue__isAnyError(JSC__JSValue JSValue0) +bool JSC__JSValue__isAnyError(JSC::EncodedJSValue JSValue0) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); @@ -3375,8 +3370,8 @@ bool JSC__JSValue__isAnyError(JSC__JSValue JSValue0) } // This implementation closely mimics the one in JSC::JSPromise::reject -void JSC__JSPromise__rejectOnNextTickWithHandled(JSC__JSPromise* promise, JSC__JSGlobalObject* lexicalGlobalObject, - JSC__JSValue encoedValue, bool handled) +void JSC__JSPromise__rejectOnNextTickWithHandled(JSC::JSPromise* promise, JSC::JSGlobalObject* lexicalGlobalObject, + JSC::EncodedJSValue encoedValue, bool handled) { JSC::JSValue value = JSC::JSValue::decode(encoedValue); auto& vm = JSC::getVM(lexicalGlobalObject); @@ -3400,7 +3395,7 @@ void JSC__JSPromise__rejectOnNextTickWithHandled(JSC__JSPromise* promise, JSC__J } } -JSC__JSPromise* JSC__JSPromise__resolvedPromise(JSC__JSGlobalObject* globalObject, JSC__JSValue JSValue1) +JSC::JSPromise* JSC__JSPromise__resolvedPromise(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue JSValue1) { auto& vm = JSC::getVM(globalObject); JSC::JSPromise* promise = JSC::JSPromise::create(vm, globalObject->promiseStructure()); @@ -3409,7 +3404,7 @@ JSC__JSPromise* JSC__JSPromise__resolvedPromise(JSC__JSGlobalObject* globalObjec return promise; } -JSC__JSValue JSC__JSPromise__result(JSC__JSPromise* promise, JSC__VM* arg1) +JSC::EncodedJSValue JSC__JSPromise__result(JSC::JSPromise* promise, JSC::VM* arg1) { auto& vm = *arg1; @@ -3431,7 +3426,7 @@ JSC__JSValue JSC__JSPromise__result(JSC__JSPromise* promise, JSC__VM* arg1) } } -uint32_t JSC__JSPromise__status(const JSC__JSPromise* arg0, JSC__VM* arg1) +uint32_t JSC__JSPromise__status(const JSC::JSPromise* arg0, JSC::VM* arg1) { switch (arg0->status(reinterpret_cast(arg1))) { case JSC::JSPromise::Status::Pending: @@ -3444,11 +3439,11 @@ uint32_t JSC__JSPromise__status(const JSC__JSPromise* arg0, JSC__VM* arg1) return 255; } } -bool JSC__JSPromise__isHandled(const JSC__JSPromise* arg0, JSC__VM* arg1) +bool JSC__JSPromise__isHandled(const JSC::JSPromise* arg0, JSC::VM* arg1) { return arg0->isHandled(reinterpret_cast(arg1)); } -void JSC__JSPromise__setHandled(JSC__JSPromise* promise, JSC__VM* arg1) +void JSC__JSPromise__setHandled(JSC::JSPromise* promise, JSC::VM* arg1) { auto& vm = *arg1; auto flags = promise->internalField(JSC::JSPromise::Field::Flags).get().asUInt32(); @@ -3457,14 +3452,14 @@ void JSC__JSPromise__setHandled(JSC__JSPromise* promise, JSC__VM* arg1) #pragma mark - JSC::JSInternalPromise -JSC__JSInternalPromise* JSC__JSInternalPromise__create(JSC__JSGlobalObject* globalObject) +JSC::JSInternalPromise* JSC__JSInternalPromise__create(JSC::JSGlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); return JSC::JSInternalPromise::create(vm, globalObject->internalPromiseStructure()); } -void JSC__JSInternalPromise__reject(JSC__JSInternalPromise* arg0, JSC__JSGlobalObject* globalObject, - JSC__JSValue JSValue2) +void JSC__JSInternalPromise__reject(JSC::JSInternalPromise* arg0, JSC::JSGlobalObject* globalObject, + JSC::EncodedJSValue JSValue2) { JSValue value = JSC::JSValue::decode(JSValue2); auto& vm = JSC::getVM(globalObject); @@ -3477,43 +3472,43 @@ void JSC__JSInternalPromise__reject(JSC__JSInternalPromise* arg0, JSC__JSGlobalO arg0->reject(globalObject, exception); } -void JSC__JSInternalPromise__rejectAsHandled(JSC__JSInternalPromise* arg0, - JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2) +void JSC__JSInternalPromise__rejectAsHandled(JSC::JSInternalPromise* arg0, + JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2) { arg0->rejectAsHandled(arg1, JSC::JSValue::decode(JSValue2)); } -void JSC__JSInternalPromise__rejectAsHandledException(JSC__JSInternalPromise* arg0, - JSC__JSGlobalObject* arg1, - JSC__Exception* arg2) +void JSC__JSInternalPromise__rejectAsHandledException(JSC::JSInternalPromise* arg0, + JSC::JSGlobalObject* arg1, + JSC::Exception* arg2) { arg0->rejectAsHandled(arg1, arg2); } -JSC__JSInternalPromise* JSC__JSInternalPromise__rejectedPromise(JSC__JSGlobalObject* arg0, - JSC__JSValue JSValue1) +JSC::JSInternalPromise* JSC__JSInternalPromise__rejectedPromise(JSC::JSGlobalObject* arg0, + JSC::EncodedJSValue JSValue1) { return jsCast( JSC::JSInternalPromise::rejectedPromise(arg0, JSC::JSValue::decode(JSValue1))); } -void JSC__JSInternalPromise__resolve(JSC__JSInternalPromise* arg0, JSC__JSGlobalObject* arg1, - JSC__JSValue JSValue2) +void JSC__JSInternalPromise__resolve(JSC::JSInternalPromise* arg0, JSC::JSGlobalObject* arg1, + JSC::EncodedJSValue JSValue2) { arg0->resolve(arg1, JSC::JSValue::decode(JSValue2)); } -JSC__JSInternalPromise* JSC__JSInternalPromise__resolvedPromise(JSC__JSGlobalObject* arg0, - JSC__JSValue JSValue1) +JSC::JSInternalPromise* JSC__JSInternalPromise__resolvedPromise(JSC::JSGlobalObject* arg0, + JSC::EncodedJSValue JSValue1) { return reinterpret_cast( JSC::JSInternalPromise::resolvedPromise(arg0, JSC::JSValue::decode(JSValue1))); } -JSC__JSValue JSC__JSInternalPromise__result(const JSC__JSInternalPromise* arg0, JSC__VM* arg1) +JSC::EncodedJSValue JSC__JSInternalPromise__result(const JSC::JSInternalPromise* arg0, JSC::VM* arg1) { return JSC::JSValue::encode(arg0->result(reinterpret_cast(arg1))); } -uint32_t JSC__JSInternalPromise__status(const JSC__JSInternalPromise* arg0, JSC__VM* arg1) +uint32_t JSC__JSInternalPromise__status(const JSC::JSInternalPromise* arg0, JSC::VM* arg1) { switch (arg0->status(reinterpret_cast(arg1))) { case JSC::JSInternalPromise::Status::Pending: @@ -3526,11 +3521,11 @@ uint32_t JSC__JSInternalPromise__status(const JSC__JSInternalPromise* arg0, JSC_ return 255; } } -bool JSC__JSInternalPromise__isHandled(const JSC__JSInternalPromise* arg0, JSC__VM* arg1) +bool JSC__JSInternalPromise__isHandled(const JSC::JSInternalPromise* arg0, JSC::VM* arg1) { return arg0->isHandled(reinterpret_cast(arg1)); } -void JSC__JSInternalPromise__setHandled(JSC__JSInternalPromise* promise, JSC__VM* arg1) +void JSC__JSInternalPromise__setHandled(JSC::JSInternalPromise* promise, JSC::VM* arg1) { auto& vm = *arg1; auto flags = promise->internalField(JSC::JSPromise::Field::Flags).get().asUInt32(); @@ -3539,7 +3534,7 @@ void JSC__JSInternalPromise__setHandled(JSC__JSInternalPromise* promise, JSC__VM #pragma mark - JSC::JSGlobalObject -JSC__JSValue JSC__JSGlobalObject__generateHeapSnapshot(JSC__JSGlobalObject* globalObject) +JSC::EncodedJSValue JSC__JSGlobalObject__generateHeapSnapshot(JSC::JSGlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); @@ -3556,75 +3551,69 @@ JSC__JSValue JSC__JSGlobalObject__generateHeapSnapshot(JSC__JSGlobalObject* glob return result; } -JSC__VM* JSC__JSGlobalObject__vm(JSC__JSGlobalObject* arg0) { return &arg0->vm(); }; -// JSC__JSObject* JSC__JSGlobalObject__createError(JSC__JSGlobalObject* arg0, -// unsigned char ErrorType1, WTF__String* arg2) {}; JSC__JSObject* -// JSC__JSGlobalObject__throwError(JSC__JSGlobalObject* arg0, JSC__JSObject* -// arg1) {}; +JSC::VM* JSC__JSGlobalObject__vm(JSC::JSGlobalObject* arg0) { return &arg0->vm(); }; -void JSC__JSGlobalObject__handleRejectedPromises(JSC__JSGlobalObject* arg0) +void JSC__JSGlobalObject__handleRejectedPromises(JSC::JSGlobalObject* arg0) { return jsCast(arg0)->handleRejectedPromises(); } #pragma mark - JSC::JSValue -JSC__JSCell* JSC__JSValue__asCell(JSC__JSValue JSValue0) +JSC::JSCell* JSC__JSValue__asCell(JSC::EncodedJSValue JSValue0) { auto value = JSC::JSValue::decode(JSValue0); return value.asCell(); } -double JSC__JSValue__asNumber(JSC__JSValue JSValue0) +double JSC__JSValue__asNumber(JSC::EncodedJSValue JSValue0) { auto value = JSC::JSValue::decode(JSValue0); return value.asNumber(); }; -JSC__JSString* JSC__JSValue__asString(JSC__JSValue JSValue0) +JSC::JSString* JSC__JSValue__asString(JSC::EncodedJSValue JSValue0) { auto value = JSC::JSValue::decode(JSValue0); return JSC::asString(value); }; -// uint64_t JSC__JSValue__encode(JSC__JSValue JSValue0) { -// } -bool JSC__JSValue__eqlCell(JSC__JSValue JSValue0, JSC__JSCell* arg1) +bool JSC__JSValue__eqlCell(JSC::EncodedJSValue JSValue0, JSC::JSCell* arg1) { return JSC::JSValue::decode(JSValue0) == arg1; }; -bool JSC__JSValue__eqlValue(JSC__JSValue JSValue0, JSC__JSValue JSValue1) +bool JSC__JSValue__eqlValue(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1) { return JSC::JSValue::decode(JSValue0) == JSC::JSValue::decode(JSValue1); }; -JSC__JSValue JSC__JSValue__getPrototype(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1) +JSC::EncodedJSValue JSC__JSValue__getPrototype(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1) { auto value = JSC::JSValue::decode(JSValue0); return JSC::JSValue::encode(value.getPrototype(arg1)); } -bool JSC__JSValue__isException(JSC__JSValue JSValue0, JSC__VM* arg1) +bool JSC__JSValue__isException(JSC::EncodedJSValue JSValue0, JSC::VM* arg1) { return JSC::jsDynamicCast(JSC::JSValue::decode(JSValue0)) != nullptr; } -bool JSC__JSValue__isAnyInt(JSC__JSValue JSValue0) +bool JSC__JSValue__isAnyInt(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isAnyInt(); } -bool JSC__JSValue__isBigInt(JSC__JSValue JSValue0) +bool JSC__JSValue__isBigInt(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isBigInt(); } -bool JSC__JSValue__isBigInt32(JSC__JSValue JSValue0) +bool JSC__JSValue__isBigInt32(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isBigInt32(); } -void JSC__JSValue__put(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, const ZigString* arg2, JSC__JSValue JSValue3) +void JSC__JSValue__put(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, const ZigString* arg2, JSC::EncodedJSValue JSValue3) { JSC::JSObject* object = JSC::JSValue::decode(JSValue0).asCell()->getObject(); object->putDirect(arg1->vm(), Zig::toIdentifier(*arg2, arg1), JSC::JSValue::decode(JSValue3)); } -extern "C" void JSC__JSValue__putMayBeIndex(JSC__JSValue target, JSC__JSGlobalObject* globalObject, const BunString* key, JSC__JSValue value) +extern "C" void JSC__JSValue__putMayBeIndex(JSC::EncodedJSValue target, JSC::JSGlobalObject* globalObject, const BunString* key, JSC::EncodedJSValue value) { auto& vm = JSC::getVM(globalObject); ThrowScope scope = DECLARE_THROW_SCOPE(vm); @@ -3637,7 +3626,7 @@ extern "C" void JSC__JSValue__putMayBeIndex(JSC__JSValue target, JSC__JSGlobalOb RETURN_IF_EXCEPTION(scope, ); } -bool JSC__JSValue__isClass(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1) +bool JSC__JSValue__isClass(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1) { JSValue value = JSValue::decode(JSValue0); auto callData = getCallData(value); @@ -3654,18 +3643,18 @@ bool JSC__JSValue__isClass(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1) } return false; } -bool JSC__JSValue__isCell(JSC__JSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isCell(); } -bool JSC__JSValue__isCustomGetterSetter(JSC__JSValue JSValue0) +bool JSC__JSValue__isCell(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isCell(); } +bool JSC__JSValue__isCustomGetterSetter(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isCustomGetterSetter(); } -bool JSC__JSValue__isError(JSC__JSValue JSValue0) +bool JSC__JSValue__isError(JSC::EncodedJSValue JSValue0) { JSC::JSObject* obj = JSC::JSValue::decode(JSValue0).getObject(); return obj != nullptr && obj->isErrorInstance(); } -bool JSC__JSValue__isAggregateError(JSC__JSValue JSValue0, JSC__JSGlobalObject* global) +bool JSC__JSValue__isAggregateError(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* global) { JSValue value = JSC::JSValue::decode(JSValue0); if (value.isUndefinedOrNull() || !value || !value.isObject()) { @@ -3679,12 +3668,12 @@ bool JSC__JSValue__isAggregateError(JSC__JSValue JSValue0, JSC__JSGlobalObject* return false; } -bool JSC__JSValue__isIterable(JSC__JSValue JSValue, JSC__JSGlobalObject* global) +bool JSC__JSValue__isIterable(JSC::EncodedJSValue JSValue, JSC::JSGlobalObject* global) { return JSC::hasIteratorMethod(global, JSC::JSValue::decode(JSValue)); } -void JSC__JSValue__forEach(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, void* ctx, void (*ArgFn3)(JSC__VM* arg0, JSC__JSGlobalObject* arg1, void* arg2, JSC__JSValue JSValue3)) +void JSC__JSValue__forEach(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, void* ctx, void (*ArgFn3)(JSC::VM* arg0, JSC::JSGlobalObject* arg1, void* arg2, JSC::EncodedJSValue JSValue3)) { JSC::forEachInIterable( @@ -3694,99 +3683,99 @@ void JSC__JSValue__forEach(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, voi }); } -bool JSC__JSValue__isCallable(JSC__JSValue JSValue0) +bool JSC__JSValue__isCallable(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isCallable(); } -bool JSC__JSValue__isGetterSetter(JSC__JSValue JSValue0) +bool JSC__JSValue__isGetterSetter(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isGetterSetter(); } -bool JSC__JSValue__isHeapBigInt(JSC__JSValue JSValue0) +bool JSC__JSValue__isHeapBigInt(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isHeapBigInt(); } -bool JSC__JSValue__isInt32(JSC__JSValue JSValue0) +bool JSC__JSValue__isInt32(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isInt32(); } -bool JSC__JSValue__isInt32AsAnyInt(JSC__JSValue JSValue0) +bool JSC__JSValue__isInt32AsAnyInt(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isInt32AsAnyInt(); } -bool JSC__JSValue__isNull(JSC__JSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isNull(); } -bool JSC__JSValue__isNumber(JSC__JSValue JSValue0) +bool JSC__JSValue__isNull(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isNull(); } +bool JSC__JSValue__isNumber(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isNumber(); } -bool JSC__JSValue__isObject(JSC__JSValue JSValue0) +bool JSC__JSValue__isObject(JSC::EncodedJSValue JSValue0) { return JSValue0 != 0 && JSC::JSValue::decode(JSValue0).isObject(); } -bool JSC__JSValue__isPrimitive(JSC__JSValue JSValue0) +bool JSC__JSValue__isPrimitive(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isPrimitive(); } -bool JSC__JSValue__isSymbol(JSC__JSValue JSValue0) +bool JSC__JSValue__isSymbol(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isSymbol(); } -bool JSC__JSValue__isUInt32AsAnyInt(JSC__JSValue JSValue0) +bool JSC__JSValue__isUInt32AsAnyInt(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isUInt32AsAnyInt(); } -bool JSC__JSValue__isUndefined(JSC__JSValue JSValue0) +bool JSC__JSValue__isUndefined(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isUndefined(); } -bool JSC__JSValue__isUndefinedOrNull(JSC__JSValue JSValue0) +bool JSC__JSValue__isUndefinedOrNull(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isUndefinedOrNull(); } -JSC__JSValue JSC__JSValue__jsBoolean(bool arg0) +JSC::EncodedJSValue JSC__JSValue__jsBoolean(bool arg0) { return JSC::JSValue::encode(JSC::jsBoolean(arg0)); } -JSC__JSValue JSC__JSValue__jsDoubleNumber(double arg0) +JSC::EncodedJSValue JSC__JSValue__jsDoubleNumber(double arg0) { return JSC::JSValue::encode(JSC::jsNumber(arg0)); } -JSC__JSValue JSC__JSValue__jsEmptyString(JSC__JSGlobalObject* arg0) +JSC::EncodedJSValue JSC__JSValue__jsEmptyString(JSC::JSGlobalObject* arg0) { return JSC::JSValue::encode(JSC::jsEmptyString(arg0->vm())); } -JSC__JSValue JSC__JSValue__jsNull() +JSC::EncodedJSValue JSC__JSValue__jsNull() { return JSC::JSValue::encode(JSC::jsNull()); } -JSC__JSValue JSC__JSValue__jsNumberFromChar(unsigned char arg0) +JSC::EncodedJSValue JSC__JSValue__jsNumberFromChar(unsigned char arg0) { return JSC::JSValue::encode(JSC::jsNumber(arg0)); } -JSC__JSValue JSC__JSValue__jsNumberFromDouble(double arg0) +JSC::EncodedJSValue JSC__JSValue__jsNumberFromDouble(double arg0) { return JSC::JSValue::encode(JSC::jsNumber(arg0)); } -JSC__JSValue JSC__JSValue__jsNumberFromInt32(int32_t arg0) +JSC::EncodedJSValue JSC__JSValue__jsNumberFromInt32(int32_t arg0) { return JSC::JSValue::encode(JSC::jsNumber(arg0)); } -JSC__JSValue JSC__JSValue__jsNumberFromInt64(int64_t arg0) +JSC::EncodedJSValue JSC__JSValue__jsNumberFromInt64(int64_t arg0) { return JSC::JSValue::encode(JSC::jsNumber(arg0)); } -JSC__JSValue JSC__JSValue__jsNumberFromU16(uint16_t arg0) +JSC::EncodedJSValue JSC__JSValue__jsNumberFromU16(uint16_t arg0) { return JSC::JSValue::encode(JSC::jsNumber(arg0)); } -JSC__JSValue JSC__JSValue__jsNumberFromUint64(uint64_t arg0) +JSC::EncodedJSValue JSC__JSValue__jsNumberFromUint64(uint64_t arg0) { return JSC::JSValue::encode(JSC::jsNumber(arg0)); } -int64_t JSC__JSValue__toInt64(JSC__JSValue val) +int64_t JSC__JSValue__toInt64(JSC::EncodedJSValue val) { JSC::JSValue value = JSC::JSValue::decode(val); ASSERT(value.isHeapBigInt() || value.isNumber()); @@ -3800,7 +3789,7 @@ int64_t JSC__JSValue__toInt64(JSC__JSValue val) return static_cast(value.asDouble()); } -uint8_t JSC__JSValue__asBigIntCompare(JSC__JSValue JSValue0, JSC__JSGlobalObject* globalObject, JSC__JSValue JSValue1) +uint8_t JSC__JSValue__asBigIntCompare(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue JSValue1) { JSValue v1 = JSValue::decode(JSValue0); JSValue v2 = JSValue::decode(JSValue1); @@ -3846,12 +3835,12 @@ uint8_t JSC__JSValue__asBigIntCompare(JSC__JSValue JSValue0, JSC__JSGlobalObject return static_cast(JSBigInt::ComparisonResult::Undefined); } -JSC__JSValue JSC__JSValue__fromInt64NoTruncate(JSC__JSGlobalObject* globalObject, int64_t val) +JSC::EncodedJSValue JSC__JSValue__fromInt64NoTruncate(JSC::JSGlobalObject* globalObject, int64_t val) { return JSC::JSValue::encode(JSC::JSValue(JSC::JSBigInt::createFrom(globalObject, val))); } -JSC__JSValue JSC__JSValue__fromTimevalNoTruncate(JSC__JSGlobalObject* globalObject, int64_t nsec, int64_t sec) +JSC::EncodedJSValue JSC__JSValue__fromTimevalNoTruncate(JSC::JSGlobalObject* globalObject, int64_t nsec, int64_t sec) { auto big_nsec = JSC::JSBigInt::createFrom(globalObject, nsec); auto big_sec = JSC::JSBigInt::createFrom(globalObject, sec); @@ -3863,7 +3852,7 @@ JSC__JSValue JSC__JSValue__fromTimevalNoTruncate(JSC__JSGlobalObject* globalObje return JSC::JSValue::encode(JSC::JSBigInt::add(globalObject, big_sec_as_nsec, big_nsec)); } -JSC__JSValue JSC__JSValue__bigIntSum(JSC__JSGlobalObject* globalObject, JSC__JSValue a, JSC__JSValue b) +JSC::EncodedJSValue JSC__JSValue__bigIntSum(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue a, JSC::EncodedJSValue b) { JSC::JSValue a_value = JSC::JSValue::decode(a); JSC::JSValue b_value = JSC::JSValue::decode(b); @@ -3878,12 +3867,12 @@ JSC__JSValue JSC__JSValue__bigIntSum(JSC__JSGlobalObject* globalObject, JSC__JSV return JSC::JSValue::encode(JSC::JSBigInt::add(globalObject, big_a, big_b)); } -JSC__JSValue JSC__JSValue__fromUInt64NoTruncate(JSC__JSGlobalObject* globalObject, uint64_t val) +JSC::EncodedJSValue JSC__JSValue__fromUInt64NoTruncate(JSC::JSGlobalObject* globalObject, uint64_t val) { return JSC::JSValue::encode(JSC::JSValue(JSC::JSBigInt::createFrom(globalObject, val))); } -uint64_t JSC__JSValue__toUInt64NoTruncate(JSC__JSValue val) +uint64_t JSC__JSValue__toUInt64NoTruncate(JSC::EncodedJSValue val) { JSC::JSValue value = JSC::JSValue::decode(val); ASSERT(value.isHeapBigInt() || value.isNumber()); @@ -3909,9 +3898,9 @@ uint64_t JSC__JSValue__toUInt64NoTruncate(JSC__JSValue val) return 0; } -JSC__JSValue JSC__JSValue__createObject2(JSC__JSGlobalObject* globalObject, const ZigString* arg1, - const ZigString* arg2, JSC__JSValue JSValue3, - JSC__JSValue JSValue4) +JSC::EncodedJSValue JSC__JSValue__createObject2(JSC::JSGlobalObject* globalObject, const ZigString* arg1, + const ZigString* arg2, JSC::EncodedJSValue JSValue3, + JSC::EncodedJSValue JSValue4) { JSC::JSObject* object = JSC::constructEmptyObject(globalObject); auto key1 = Zig::toIdentifier(*arg1, globalObject); @@ -3940,8 +3929,8 @@ JSC__JSValue JSC__JSValue__createObject2(JSC__JSGlobalObject* globalObject, cons // Returns empty for exception, returns deleted if not found. // Be careful when handling the return value. -JSC__JSValue JSC__JSValue__getIfPropertyExistsImpl(JSC__JSValue JSValue0, - JSC__JSGlobalObject* globalObject, +JSC::EncodedJSValue JSC__JSValue__getIfPropertyExistsImpl(JSC::EncodedJSValue JSValue0, + JSC::JSGlobalObject* globalObject, const unsigned char* arg1, uint32_t arg2) { ASSERT_NO_PENDING_EXCEPTION(globalObject); @@ -3962,7 +3951,7 @@ JSC__JSValue JSC__JSValue__getIfPropertyExistsImpl(JSC__JSValue JSValue0, return JSC::JSValue::encode(Bun::getIfPropertyExistsPrototypePollutionMitigationUnsafe(vm, globalObject, object, property)); } -extern "C" JSC__JSValue JSC__JSValue__getOwn(JSC__JSValue JSValue0, JSC__JSGlobalObject* globalObject, BunString* propertyName) +extern "C" JSC::EncodedJSValue JSC__JSValue__getOwn(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, BunString* propertyName) { ASSERT_NO_PENDING_EXCEPTION(globalObject); @@ -3978,7 +3967,7 @@ extern "C" JSC__JSValue JSC__JSValue__getOwn(JSC__JSValue JSValue0, JSC__JSGloba return JSValue::encode({}); } -JSC__JSValue JSC__JSValue__getIfPropertyExistsFromPath(JSC__JSValue JSValue0, JSC__JSGlobalObject* globalObject, JSC__JSValue arg1) +JSC::EncodedJSValue JSC__JSValue__getIfPropertyExistsFromPath(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue arg1) { ASSERT_NO_PENDING_EXCEPTION(globalObject); VM& vm = globalObject->vm(); @@ -4100,7 +4089,7 @@ JSC__JSValue JSC__JSValue__getIfPropertyExistsFromPath(JSC__JSValue JSValue0, JS return JSValue::encode({}); } -void JSC__JSValue__getSymbolDescription(JSC__JSValue symbolValue_, JSC__JSGlobalObject* arg1, ZigString* arg2) +void JSC__JSValue__getSymbolDescription(JSC::EncodedJSValue symbolValue_, JSC::JSGlobalObject* arg1, ZigString* arg2) { JSC::JSValue symbolValue = JSC::JSValue::decode(symbolValue_); @@ -4114,7 +4103,7 @@ void JSC__JSValue__getSymbolDescription(JSC__JSValue symbolValue_, JSC__JSGlobal *arg2 = Zig::toZigString(string); } -JSC__JSValue JSC__JSValue__symbolFor(JSC__JSGlobalObject* globalObject, ZigString* arg2) +JSC::EncodedJSValue JSC__JSValue__symbolFor(JSC::JSGlobalObject* globalObject, ZigString* arg2) { auto& vm = JSC::getVM(globalObject); @@ -4122,7 +4111,7 @@ JSC__JSValue JSC__JSValue__symbolFor(JSC__JSGlobalObject* globalObject, ZigStrin return JSC::JSValue::encode(JSC::Symbol::create(vm, vm.symbolRegistry().symbolForKey(string))); } -bool JSC__JSValue__symbolKeyFor(JSC__JSValue symbolValue_, JSC__JSGlobalObject* arg1, ZigString* arg2) +bool JSC__JSValue__symbolKeyFor(JSC::EncodedJSValue symbolValue_, JSC::JSGlobalObject* arg1, ZigString* arg2) { JSC::JSValue symbolValue = JSC::JSValue::decode(symbolValue_); JSC::VM& vm = arg1->vm(); @@ -4139,25 +4128,24 @@ bool JSC__JSValue__symbolKeyFor(JSC__JSValue symbolValue_, JSC__JSGlobalObject* return true; } -int32_t JSC__JSValue__toInt32(JSC__JSValue JSValue0) +int32_t JSC__JSValue__toInt32(JSC::EncodedJSValue JSValue0) { return JSC::JSValue::decode(JSValue0).asInt32(); } -CPP_DECL double JSC__JSValue__coerceToDouble(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1) +CPP_DECL double JSC__JSValue__coerceToDouble(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1) { ASSERT_NO_PENDING_EXCEPTION(arg1); JSC::JSValue value = JSC::JSValue::decode(JSValue0); - auto catchScope = DECLARE_CATCH_SCOPE(arg1->vm()); + auto scope = DECLARE_THROW_SCOPE(arg1->vm()); double result = value.toNumber(arg1); - if (catchScope.exception()) { + if (scope.exception()) { result = PNaN; - catchScope.clearException(); } return result; } -CPP_DECL double Bun__JSValue__toNumber(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, bool* had_exception) +CPP_DECL double Bun__JSValue__toNumber(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, bool* had_exception) { ASSERT_NO_PENDING_EXCEPTION(arg1); auto catchScope = DECLARE_CATCH_SCOPE(arg1->vm()); @@ -4170,7 +4158,7 @@ CPP_DECL double Bun__JSValue__toNumber(JSC__JSValue JSValue0, JSC__JSGlobalObjec } // truncates values larger than int32 -int32_t JSC__JSValue__coerceToInt32(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1) +int32_t JSC__JSValue__coerceToInt32(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); if (value.isCell() && value.isHeapBigInt()) { @@ -4179,7 +4167,7 @@ int32_t JSC__JSValue__coerceToInt32(JSC__JSValue JSValue0, JSC__JSGlobalObject* return value.toInt32(arg1); } -int64_t JSC__JSValue__coerceToInt64(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1) +int64_t JSC__JSValue__coerceToInt64(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1) { JSValue value = JSValue::decode(JSValue0); if (value.isCell() && value.isHeapBigInt()) { @@ -4198,32 +4186,32 @@ int64_t JSC__JSValue__coerceToInt64(JSC__JSValue JSValue0, JSC__JSGlobalObject* return value.toInt32(arg1); } -JSC__JSValue JSC__JSValue__getErrorsProperty(JSC__JSValue JSValue0, JSC__JSGlobalObject* global) +JSC::EncodedJSValue JSC__JSValue__getErrorsProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* global) { JSC::JSObject* obj = JSC::JSValue::decode(JSValue0).getObject(); return JSC::JSValue::encode(obj->getDirect(global->vm(), global->vm().propertyNames->errors)); } -JSC__JSValue JSC__JSValue__jsTDZValue() { return JSC::JSValue::encode(JSC::jsTDZValue()); }; -JSC__JSValue JSC__JSValue__jsUndefined() { return JSC::JSValue::encode(JSC::jsUndefined()); }; -JSC__JSObject* JSC__JSValue__toObject(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1) +JSC::EncodedJSValue JSC__JSValue__jsTDZValue() { return JSC::JSValue::encode(JSC::jsTDZValue()); }; +JSC::EncodedJSValue JSC__JSValue__jsUndefined() { return JSC::JSValue::encode(JSC::jsUndefined()); }; +JSC::JSObject* JSC__JSValue__toObject(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); return value.toObject(arg1); } -JSC__JSString* JSC__JSValue__toString(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1) +JSC::JSString* JSC__JSValue__toString(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); return value.toString(arg1); }; -JSC__JSString* JSC__JSValue__toStringOrNull(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1) +JSC::JSString* JSC__JSValue__toStringOrNull(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); return value.toStringOrNull(arg1); } -bool JSC__JSValue__toMatch(JSC__JSValue regexValue, JSC__JSGlobalObject* global, JSC__JSValue value) +bool JSC__JSValue__toMatch(JSC::EncodedJSValue regexValue, JSC::JSGlobalObject* global, JSC::EncodedJSValue value) { ASSERT_NO_PENDING_EXCEPTION(global); JSC::JSValue regex = JSC::JSValue::decode(regexValue); @@ -4236,7 +4224,7 @@ bool JSC__JSValue__toMatch(JSC__JSValue regexValue, JSC__JSGlobalObject* global, return !!regexObject->match(global, JSC::asString(str)); } -bool JSC__JSValue__stringIncludes(JSC__JSValue value, JSC__JSGlobalObject* globalObject, JSC__JSValue other) +bool JSC__JSValue__stringIncludes(JSC::EncodedJSValue value, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue other) { VM& vm = globalObject->vm(); auto scope = DECLARE_CATCH_SCOPE(vm); @@ -4944,18 +4932,18 @@ void exceptionFromString(ZigException* except, JSC::JSValue value, JSC::JSGlobal except->message = Bun::toStringRef(str); } -extern "C" JSC::EncodedJSValue JSC__Exception__asJSValue(JSC__Exception* exception) +extern "C" JSC::EncodedJSValue JSC__Exception__asJSValue(JSC::Exception* exception) { JSC::Exception* jscException = jsCast(exception); return JSC::JSValue::encode(jscException); } -void JSC__VM__releaseWeakRefs(JSC__VM* arg0) +void JSC__VM__releaseWeakRefs(JSC::VM* arg0) { arg0->finalizeSynchronousJSExecution(); } -void JSC__JSValue__getClassName(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, ZigString* arg2) +void JSC__JSValue__getClassName(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, ZigString* arg2) { JSValue value = JSValue::decode(JSValue0); JSC::JSCell* cell = value.asCell(); @@ -4994,7 +4982,7 @@ bool JSC__JSValue__getClassInfoName(JSValue value, const uint8_t** outPtr, size_ return false; } -void JSC__JSValue__getNameProperty(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, ZigString* arg2) +void JSC__JSValue__getNameProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, ZigString* arg2) { JSC::JSObject* obj = JSC::JSValue::decode(JSValue0).getObject(); JSC::VM& vm = arg1->vm(); @@ -5037,7 +5025,7 @@ void JSC__JSValue__getNameProperty(JSC__JSValue JSValue0, JSC__JSGlobalObject* a arg2->len = 0; } -extern "C" void JSC__JSValue__getName(JSC__JSValue JSValue0, JSC__JSGlobalObject* globalObject, BunString* arg2) +extern "C" void JSC__JSValue__getName(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, BunString* arg2) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); if (!value.isObject()) { @@ -5063,7 +5051,7 @@ extern "C" void JSC__JSValue__getName(JSC__JSValue JSValue0, JSC__JSGlobalObject *arg2 = Bun::toStringRef(displayName); } -JSC__JSValue JSC__JSValue__toError_(JSC__JSValue JSValue0) +JSC::EncodedJSValue JSC__JSValue__toError_(JSC::EncodedJSValue JSValue0) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); if (value.isEmpty() || !value.isCell()) @@ -5087,7 +5075,7 @@ JSC__JSValue JSC__JSValue__toError_(JSC__JSValue JSValue0) return JSC::JSValue::encode({}); } -void JSC__JSValue__toZigException(JSC__JSValue jsException, JSC__JSGlobalObject* global, ZigException* exception) +void JSC__JSValue__toZigException(JSC::EncodedJSValue jsException, JSC::JSGlobalObject* global, ZigException* exception) { JSC::JSValue value = JSC::JSValue::decode(jsException); if (value == JSC::JSValue {}) { @@ -5122,7 +5110,7 @@ void JSC__JSValue__toZigException(JSC__JSValue jsException, JSC__JSGlobalObject* exceptionFromString(exception, value, global); } -void ZigException__collectSourceLines(JSC__JSValue jsException, JSC__JSGlobalObject* global, ZigException* exception) +void ZigException__collectSourceLines(JSC::EncodedJSValue jsException, JSC::JSGlobalObject* global, ZigException* exception) { JSC::JSValue value = JSC::JSValue::decode(jsException); if (value == JSC::JSValue {}) { @@ -5151,7 +5139,7 @@ void ZigException__collectSourceLines(JSC__JSValue jsException, JSC__JSGlobalObj #pragma mark - JSC::VM -size_t JSC__VM__runGC(JSC__VM* vm, bool sync) +size_t JSC__VM__runGC(JSC::VM* vm, bool sync) { JSC::JSLockHolder lock(vm); @@ -5188,20 +5176,20 @@ size_t JSC__VM__runGC(JSC__VM* vm, bool sync) bool JSC__VM__isJITEnabled() { return JSC::Options::useJIT(); } -void JSC__VM__clearExecutionTimeLimit(JSC__VM* vm) +void JSC__VM__clearExecutionTimeLimit(JSC::VM* vm) { JSC::JSLockHolder locker(vm); if (vm->watchdog()) vm->watchdog()->setTimeLimit(JSC::Watchdog::noTimeLimit); } -void JSC__VM__setExecutionTimeLimit(JSC__VM* vm, double limit) +void JSC__VM__setExecutionTimeLimit(JSC::VM* vm, double limit) { JSC::JSLockHolder locker(vm); JSC::Watchdog& watchdog = vm->ensureWatchdog(); watchdog.setTimeLimit(WTF::Seconds { limit }); } -bool JSC__JSValue__isTerminationException(JSC__JSValue JSValue0, JSC__VM* arg1) +bool JSC__JSValue__isTerminationException(JSC::EncodedJSValue JSValue0, JSC::VM* arg1) { JSC::Exception* exception = JSC::jsDynamicCast(JSC::JSValue::decode(JSValue0)); return exception != NULL && arg1->isTerminationException(exception); @@ -5212,10 +5200,10 @@ extern "C" void JSC__Exception__getStackTrace(JSC::Exception* arg0, JSC::JSGloba populateStackTrace(arg0->vm(), arg0->stack(), trace, global, PopulateStackTraceFlags::OnlyPosition); } -void JSC__VM__shrinkFootprint(JSC__VM* arg0) { arg0->shrinkFootprintWhenIdle(); }; -void JSC__VM__whenIdle(JSC__VM* arg0, void (*ArgFn1)()) { arg0->whenIdle(ArgFn1); }; +void JSC__VM__shrinkFootprint(JSC::VM* arg0) { arg0->shrinkFootprintWhenIdle(); }; +void JSC__VM__whenIdle(JSC::VM* arg0, void (*ArgFn1)()) { arg0->whenIdle(ArgFn1); }; -void JSC__VM__holdAPILock(JSC__VM* arg0, void* ctx, void (*callback)(void* arg0)) +void JSC__VM__holdAPILock(JSC::VM* arg0, void* ctx, void (*callback)(void* arg0)) { JSC::JSLockHolder locker(arg0); callback(ctx); @@ -5238,13 +5226,13 @@ extern "C" void JSC__VM__releaseAPILock(JSC::VM* vm) apiLock->unlock(); } -void JSC__JSString__iterator(JSC__JSString* arg0, JSC__JSGlobalObject* arg1, void* arg2) +void JSC__JSString__iterator(JSC::JSString* arg0, JSC::JSGlobalObject* arg1, void* arg2) { jsstring_iterator* iter = (jsstring_iterator*)arg2; arg0->value(iter); } -void JSC__VM__deleteAllCode(JSC__VM* arg1, JSC__JSGlobalObject* globalObject) +void JSC__VM__deleteAllCode(JSC::VM* arg1, JSC::JSGlobalObject* globalObject) { JSC::JSLockHolder locker(globalObject->vm()); @@ -5258,22 +5246,22 @@ void JSC__VM__deleteAllCode(JSC__VM* arg1, JSC__JSGlobalObject* globalObject) arg1->heap.reportAbandonedObjectGraph(); } -void JSC__VM__reportExtraMemory(JSC__VM* arg0, size_t arg1) +void JSC__VM__reportExtraMemory(JSC::VM* arg0, size_t arg1) { arg0->heap.deprecatedReportExtraMemory(arg1); } -void JSC__VM__deinit(JSC__VM* arg1, JSC__JSGlobalObject* globalObject) {} -void JSC__VM__drainMicrotasks(JSC__VM* arg0) { arg0->drainMicrotasks(); } +void JSC__VM__deinit(JSC::VM* arg1, JSC::JSGlobalObject* globalObject) {} +void JSC__VM__drainMicrotasks(JSC::VM* arg0) { arg0->drainMicrotasks(); } -bool JSC__VM__executionForbidden(JSC__VM* arg0) { return (*arg0).executionForbidden(); } +bool JSC__VM__executionForbidden(JSC::VM* arg0) { return (*arg0).executionForbidden(); } -bool JSC__VM__isEntered(JSC__VM* arg0) { return (*arg0).isEntered(); } +bool JSC__VM__isEntered(JSC::VM* arg0) { return (*arg0).isEntered(); } -void JSC__VM__setExecutionForbidden(JSC__VM* arg0, bool arg1) { (*arg0).setExecutionForbidden(); } +void JSC__VM__setExecutionForbidden(JSC::VM* arg0, bool arg1) { (*arg0).setExecutionForbidden(); } // These may be called concurrently from another thread. -void JSC__VM__notifyNeedTermination(JSC__VM* arg0) +void JSC__VM__notifyNeedTermination(JSC::VM* arg0) { JSC::VM& vm = *arg0; bool didEnter = vm.currentThreadIsHoldingAPILock(); @@ -5283,11 +5271,11 @@ void JSC__VM__notifyNeedTermination(JSC__VM* arg0) if (didEnter) vm.apiLock().lock(); } -void JSC__VM__notifyNeedDebuggerBreak(JSC__VM* arg0) { (*arg0).notifyNeedDebuggerBreak(); } -void JSC__VM__notifyNeedShellTimeoutCheck(JSC__VM* arg0) { (*arg0).notifyNeedShellTimeoutCheck(); } -void JSC__VM__notifyNeedWatchdogCheck(JSC__VM* arg0) { (*arg0).notifyNeedWatchdogCheck(); } +void JSC__VM__notifyNeedDebuggerBreak(JSC::VM* arg0) { (*arg0).notifyNeedDebuggerBreak(); } +void JSC__VM__notifyNeedShellTimeoutCheck(JSC::VM* arg0) { (*arg0).notifyNeedShellTimeoutCheck(); } +void JSC__VM__notifyNeedWatchdogCheck(JSC::VM* arg0) { (*arg0).notifyNeedWatchdogCheck(); } -void JSC__VM__throwError(JSC__VM* vm_, JSC__JSGlobalObject* arg1, JSC__JSValue encodedValue) +void JSC__VM__throwError(JSC::VM* vm_, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue encodedValue) { JSC::VM& vm = *reinterpret_cast(vm_); auto scope = DECLARE_THROW_SCOPE(vm); @@ -5312,8 +5300,8 @@ void JSC__VM__throwError(JSC__VM* vm_, JSC__JSGlobalObject* arg1, JSC__JSValue e /// **DEPRECATED** This function does not notify the VM about the rejection, /// meaning it will not trigger unhandled rejection handling. Use JSC__JSPromise__rejectedPromise instead. -JSC__JSValue JSC__JSPromise__rejectedPromiseValue(JSC__JSGlobalObject* globalObject, - JSC__JSValue JSValue1) +JSC::EncodedJSValue JSC__JSPromise__rejectedPromiseValue(JSC::JSGlobalObject* globalObject, + JSC::EncodedJSValue JSValue1) { auto& vm = JSC::getVM(globalObject); JSC::JSPromise* promise = JSC::JSPromise::create(vm, globalObject->promiseStructure()); @@ -5324,8 +5312,8 @@ JSC__JSValue JSC__JSPromise__rejectedPromiseValue(JSC__JSGlobalObject* globalObj return JSC::JSValue::encode(promise); } -JSC__JSValue JSC__JSPromise__resolvedPromiseValue(JSC__JSGlobalObject* globalObject, - JSC__JSValue JSValue1) +JSC::EncodedJSValue JSC__JSPromise__resolvedPromiseValue(JSC::JSGlobalObject* globalObject, + JSC::EncodedJSValue JSValue1) { auto& vm = JSC::getVM(globalObject); JSC::JSPromise* promise = JSC::JSPromise::create(vm, globalObject->promiseStructure()); @@ -5337,7 +5325,7 @@ JSC__JSValue JSC__JSPromise__resolvedPromiseValue(JSC__JSGlobalObject* globalObj } } -JSC__JSValue JSC__JSValue__createUninitializedUint8Array(JSC__JSGlobalObject* arg0, size_t arg1) +JSC::EncodedJSValue JSC__JSValue__createUninitializedUint8Array(JSC::JSGlobalObject* arg0, size_t arg1) { JSC::JSValue value = JSC::JSUint8Array::createUninitialized(arg0, arg0->m_typedArrayUint8.get(arg0), arg1); return JSC::JSValue::encode(value); @@ -5450,7 +5438,7 @@ static inline const JSC::Identifier& builtinNameMap(JSC::VM& vm, unsigned char n } } -JSC__JSValue JSC__JSValue__fastGetDirect_(JSC__JSValue JSValue0, JSC__JSGlobalObject* globalObject, unsigned char arg2) +JSC::EncodedJSValue JSC__JSValue__fastGetDirect_(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, unsigned char arg2) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); ASSERT(value.isCell()); @@ -5459,7 +5447,7 @@ JSC__JSValue JSC__JSValue__fastGetDirect_(JSC__JSValue JSValue0, JSC__JSGlobalOb // Returns empty for exception, returns deleted if not found. // Be careful when handling the return value. -JSC__JSValue JSC__JSValue__fastGet(JSC__JSValue JSValue0, JSC__JSGlobalObject* globalObject, unsigned char arg2) +JSC::EncodedJSValue JSC__JSValue__fastGet(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, unsigned char arg2) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); ASSERT(value.isCell()); @@ -5472,7 +5460,7 @@ JSC__JSValue JSC__JSValue__fastGet(JSC__JSValue JSValue0, JSC__JSGlobalObject* g return JSC::JSValue::encode(Bun::getIfPropertyExistsPrototypePollutionMitigationUnsafe(vm, globalObject, object, property)); } -extern "C" JSC__JSValue JSC__JSValue__fastGetOwn(JSC__JSValue JSValue0, JSC__JSGlobalObject* globalObject, unsigned char arg2) +extern "C" JSC::EncodedJSValue JSC__JSValue__fastGetOwn(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, unsigned char arg2) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); ASSERT(value.isCell()); @@ -5487,20 +5475,20 @@ extern "C" JSC__JSValue JSC__JSValue__fastGetOwn(JSC__JSValue JSValue0, JSC__JSG return JSValue::encode({}); } -bool JSC__JSValue__toBoolean(JSC__JSValue JSValue0) +bool JSC__JSValue__toBoolean(JSC::EncodedJSValue JSValue0) { // We count masquerades as undefined as true. return JSValue::decode(JSValue0).pureToBoolean() != TriState::False; } -extern "C" void JSGlobalObject__throwStackOverflow(JSC__JSGlobalObject* globalObject) +extern "C" void JSGlobalObject__throwStackOverflow(JSC::JSGlobalObject* globalObject) { auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); throwStackOverflowError(globalObject, scope); } template -static void JSC__JSValue__forEachPropertyImpl(JSC__JSValue JSValue0, JSC__JSGlobalObject* globalObject, void* arg2, void (*iter)(JSC__JSGlobalObject* arg0, void* ctx, ZigString* arg2, JSC__JSValue JSValue3, bool isSymbol, bool isPrivateSymbol)) +static void JSC__JSValue__forEachPropertyImpl(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, void* arg2, void (*iter)(JSC::JSGlobalObject* arg0, void* ctx, ZigString* arg2, JSC::EncodedJSValue JSValue3, bool isSymbol, bool isPrivateSymbol)) { ASSERT_NO_PENDING_EXCEPTION(globalObject); JSC::JSValue value = JSC::JSValue::decode(JSValue0); @@ -5748,17 +5736,17 @@ restart: } } -void JSC__JSValue__forEachProperty(JSC__JSValue JSValue0, JSC__JSGlobalObject* globalObject, void* arg2, void (*iter)(JSC__JSGlobalObject* arg0, void* ctx, ZigString* arg2, JSC__JSValue JSValue3, bool isSymbol, bool isPrivateSymbol)) +void JSC__JSValue__forEachProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, void* arg2, void (*iter)(JSC::JSGlobalObject* arg0, void* ctx, ZigString* arg2, JSC::EncodedJSValue JSValue3, bool isSymbol, bool isPrivateSymbol)) { JSC__JSValue__forEachPropertyImpl(JSValue0, globalObject, arg2, iter); } -extern "C" void JSC__JSValue__forEachPropertyNonIndexed(JSC__JSValue JSValue0, JSC__JSGlobalObject* globalObject, void* arg2, void (*iter)(JSC__JSGlobalObject* arg0, void* ctx, ZigString* arg2, JSC__JSValue JSValue3, bool isSymbol, bool isPrivateSymbol)) +extern "C" void JSC__JSValue__forEachPropertyNonIndexed(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, void* arg2, void (*iter)(JSC::JSGlobalObject* arg0, void* ctx, ZigString* arg2, JSC::EncodedJSValue JSValue3, bool isSymbol, bool isPrivateSymbol)) { JSC__JSValue__forEachPropertyImpl(JSValue0, globalObject, arg2, iter); } -void JSC__JSValue__forEachPropertyOrdered(JSC__JSValue JSValue0, JSC__JSGlobalObject* globalObject, void* arg2, void (*iter)(JSC__JSGlobalObject* arg0, void* ctx, ZigString* arg2, JSC__JSValue JSValue3, bool isSymbol, bool isPrivateSymbol)) +void JSC__JSValue__forEachPropertyOrdered(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, void* arg2, void (*iter)(JSC::JSGlobalObject* arg0, void* ctx, ZigString* arg2, JSC::EncodedJSValue JSValue3, bool isSymbol, bool isPrivateSymbol)) { JSC::JSValue value = JSC::JSValue::decode(JSValue0); JSC::JSObject* object = value.getObject(); @@ -5838,13 +5826,13 @@ void JSC__JSValue__forEachPropertyOrdered(JSC__JSValue JSValue0, JSC__JSGlobalOb properties.releaseData(); } -bool JSC__JSValue__isConstructor(JSC__JSValue JSValue0) +bool JSC__JSValue__isConstructor(JSC::EncodedJSValue JSValue0) { JSValue value = JSValue::decode(JSValue0); return value.isConstructor(); } -bool JSC__JSValue__isInstanceOf(JSC__JSValue JSValue0, JSC__JSGlobalObject* globalObject, JSC__JSValue JSValue1) +bool JSC__JSValue__isInstanceOf(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue JSValue1) { VM& vm = globalObject->vm(); @@ -5865,12 +5853,12 @@ bool JSC__JSValue__isInstanceOf(JSC__JSValue JSValue0, JSC__JSGlobalObject* glob return result; } -extern "C" JSC__JSValue JSC__JSValue__createRopeString(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* globalObject) +extern "C" JSC::EncodedJSValue JSC__JSValue__createRopeString(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* globalObject) { return JSValue::encode(JSC::jsString(globalObject, JSC::JSValue::decode(JSValue0).toString(globalObject), JSC::JSValue::decode(JSValue1).toString(globalObject))); } -extern "C" size_t JSC__VM__blockBytesAllocated(JSC__VM* vm) +extern "C" size_t JSC__VM__blockBytesAllocated(JSC::VM* vm) { #if ENABLE(RESOURCE_USAGE) return vm->heap.blockBytesAllocated() + vm->heap.extraMemorySize(); @@ -5878,7 +5866,7 @@ extern "C" size_t JSC__VM__blockBytesAllocated(JSC__VM* vm) return 0; #endif } -extern "C" size_t JSC__VM__externalMemorySize(JSC__VM* vm) +extern "C" size_t JSC__VM__externalMemorySize(JSC::VM* vm) { #if ENABLE(RESOURCE_USAGE) return vm->heap.externalMemorySize(); @@ -5887,7 +5875,7 @@ extern "C" size_t JSC__VM__externalMemorySize(JSC__VM* vm) #endif } -extern "C" void JSC__JSGlobalObject__queueMicrotaskJob(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue JSValue3, JSC__JSValue JSValue4) +extern "C" void JSC__JSGlobalObject__queueMicrotaskJob(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue JSValue3, JSC::EncodedJSValue JSValue4) { Zig::GlobalObject* globalObject = reinterpret_cast(arg0); JSValue microtaskArgs[] = { @@ -5919,7 +5907,7 @@ extern "C" void JSC__JSGlobalObject__queueMicrotaskJob(JSC__JSGlobalObject* arg0 WTFMove(microtaskArgs[3])); } -extern "C" WebCore::AbortSignal* WebCore__AbortSignal__new(JSC__JSGlobalObject* globalObject) +extern "C" WebCore::AbortSignal* WebCore__AbortSignal__new(JSC::JSGlobalObject* globalObject) { Zig::GlobalObject* thisObject = JSC::jsCast(globalObject); auto* context = thisObject->scriptExecutionContext(); @@ -5927,34 +5915,34 @@ extern "C" WebCore::AbortSignal* WebCore__AbortSignal__new(JSC__JSGlobalObject* return abortSignal.leakRef(); } -extern "C" JSC__JSValue WebCore__AbortSignal__create(JSC__JSGlobalObject* globalObject) +extern "C" JSC::EncodedJSValue WebCore__AbortSignal__create(JSC::JSGlobalObject* globalObject) { Zig::GlobalObject* thisObject = JSC::jsCast(globalObject); auto* context = thisObject->scriptExecutionContext(); auto abortSignal = WebCore::AbortSignal::create(context); - return JSValue::encode(toJSNewlyCreated>(*globalObject, *jsCast(globalObject), WTFMove(abortSignal))); + return JSValue::encode(toJSNewlyCreated>(*globalObject, *jsCast(globalObject), WTFMove(abortSignal))); } -extern "C" JSC__JSValue WebCore__AbortSignal__toJS(WebCore__AbortSignal* arg0, JSC__JSGlobalObject* globalObject) +extern "C" JSC::EncodedJSValue WebCore__AbortSignal__toJS(WebCore::AbortSignal* arg0, JSC::JSGlobalObject* globalObject) { WebCore::AbortSignal* abortSignal = reinterpret_cast(arg0); - return JSValue::encode(toJS>(*globalObject, *jsCast(globalObject), *abortSignal)); + return JSValue::encode(toJS>(*globalObject, *jsCast(globalObject), *abortSignal)); } -extern "C" void WebCore__AbortSignal__incrementPendingActivity(WebCore__AbortSignal* arg0) +extern "C" void WebCore__AbortSignal__incrementPendingActivity(WebCore::AbortSignal* arg0) { WebCore::AbortSignal* abortSignal = reinterpret_cast(arg0); abortSignal->incrementPendingActivityCount(); } -extern "C" void WebCore__AbortSignal__decrementPendingActivity(WebCore__AbortSignal* arg0) +extern "C" void WebCore__AbortSignal__decrementPendingActivity(WebCore::AbortSignal* arg0) { WebCore::AbortSignal* abortSignal = reinterpret_cast(arg0); abortSignal->decrementPendingActivityCount(); } -extern "C" WebCore__AbortSignal* WebCore__AbortSignal__signal(WebCore__AbortSignal* arg0, JSC::JSGlobalObject* globalObject, uint8_t reason) +extern "C" WebCore::AbortSignal* WebCore__AbortSignal__signal(WebCore::AbortSignal* arg0, JSC::JSGlobalObject* globalObject, uint8_t reason) { WebCore::AbortSignal* abortSignal = reinterpret_cast(arg0); @@ -5965,7 +5953,7 @@ extern "C" WebCore__AbortSignal* WebCore__AbortSignal__signal(WebCore__AbortSign return arg0; } -extern "C" JSC__JSValue WebCore__AbortSignal__reasonIfAborted(WebCore::AbortSignal* signal, JSC::JSGlobalObject* globalObject, CommonAbortReason* reason) +extern "C" JSC::EncodedJSValue WebCore__AbortSignal__reasonIfAborted(WebCore::AbortSignal* signal, JSC::JSGlobalObject* globalObject, CommonAbortReason* reason) { if (signal->aborted()) { *reason = signal->commonReason(); @@ -5979,38 +5967,38 @@ extern "C" JSC__JSValue WebCore__AbortSignal__reasonIfAborted(WebCore::AbortSign return JSValue::encode({}); } -extern "C" bool WebCore__AbortSignal__aborted(WebCore__AbortSignal* arg0) +extern "C" bool WebCore__AbortSignal__aborted(WebCore::AbortSignal* arg0) { WebCore::AbortSignal* abortSignal = reinterpret_cast(arg0); return abortSignal->aborted(); } -extern "C" JSC__JSValue WebCore__AbortSignal__abortReason(WebCore__AbortSignal* arg0) +extern "C" JSC::EncodedJSValue WebCore__AbortSignal__abortReason(WebCore::AbortSignal* arg0) { WebCore::AbortSignal* abortSignal = reinterpret_cast(arg0); return JSC::JSValue::encode(abortSignal->reason().getValue(jsNull())); } -extern "C" WebCore__AbortSignal* WebCore__AbortSignal__ref(WebCore__AbortSignal* arg0) +extern "C" WebCore::AbortSignal* WebCore__AbortSignal__ref(WebCore::AbortSignal* arg0) { WebCore::AbortSignal* abortSignal = reinterpret_cast(arg0); abortSignal->ref(); return arg0; } -extern "C" void WebCore__AbortSignal__unref(WebCore__AbortSignal* arg0) +extern "C" void WebCore__AbortSignal__unref(WebCore::AbortSignal* arg0) { WebCore::AbortSignal* abortSignal = reinterpret_cast(arg0); abortSignal->deref(); } -extern "C" void WebCore__AbortSignal__cleanNativeBindings(WebCore__AbortSignal* arg0, void* arg1) +extern "C" void WebCore__AbortSignal__cleanNativeBindings(WebCore::AbortSignal* arg0, void* arg1) { WebCore::AbortSignal* abortSignal = reinterpret_cast(arg0); abortSignal->cleanNativeBindings(arg1); } -extern "C" WebCore__AbortSignal* WebCore__AbortSignal__addListener(WebCore__AbortSignal* arg0, void* ctx, void (*callback)(void* ctx, JSC__JSValue reason)) +extern "C" WebCore::AbortSignal* WebCore__AbortSignal__addListener(WebCore::AbortSignal* arg0, void* ctx, void (*callback)(void* ctx, JSC::EncodedJSValue reason)) { WebCore::AbortSignal* abortSignal = reinterpret_cast(arg0); @@ -6023,7 +6011,7 @@ extern "C" WebCore__AbortSignal* WebCore__AbortSignal__addListener(WebCore__Abor return arg0; } -extern "C" WebCore__AbortSignal* WebCore__AbortSignal__fromJS(JSC__JSValue value) +extern "C" WebCore::AbortSignal* WebCore__AbortSignal__fromJS(JSC::EncodedJSValue value) { JSC::JSValue decodedValue = JSC::JSValue::decode(value); if (decodedValue.isEmpty()) @@ -6032,10 +6020,10 @@ extern "C" WebCore__AbortSignal* WebCore__AbortSignal__fromJS(JSC__JSValue value if (!object) return nullptr; - return reinterpret_cast(&object->wrapped()); + return reinterpret_cast(&object->wrapped()); } -CPP_DECL double JSC__JSValue__getUnixTimestamp(JSC__JSValue timeValue) +CPP_DECL double JSC__JSValue__getUnixTimestamp(JSC::EncodedJSValue timeValue) { JSC::JSValue decodedValue = JSC::JSValue::decode(timeValue); JSC::DateInstance* date = JSC::jsDynamicCast(decodedValue); @@ -6047,7 +6035,7 @@ CPP_DECL double JSC__JSValue__getUnixTimestamp(JSC__JSValue timeValue) return number; } -extern "C" JSC::EncodedJSValue JSC__JSValue__getOwnByValue(JSC__JSValue value, JSC__JSGlobalObject* globalObject, JSC__JSValue propertyValue) +extern "C" JSC::EncodedJSValue JSC__JSValue__getOwnByValue(JSC::EncodedJSValue value, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue propertyValue) { auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); @@ -6148,17 +6136,17 @@ extern "C" int JSC__JSValue__DateNowISOString(JSC::JSGlobalObject* globalObject, #pragma mark - WebCore::DOMFormData -CPP_DECL void WebCore__DOMFormData__append(WebCore__DOMFormData* arg0, ZigString* arg1, ZigString* arg2) +CPP_DECL void WebCore__DOMFormData__append(WebCore::DOMFormData* arg0, ZigString* arg1, ZigString* arg2) { arg0->append(toStringCopy(*arg1), toStringCopy(*arg2)); } -CPP_DECL void WebCore__DOMFormData__appendBlob(WebCore__DOMFormData* arg0, JSC__JSGlobalObject* arg1, ZigString* arg2, void* blobValueInner, ZigString* fileName) +CPP_DECL void WebCore__DOMFormData__appendBlob(WebCore::DOMFormData* arg0, JSC::JSGlobalObject* arg1, ZigString* arg2, void* blobValueInner, ZigString* fileName) { RefPtr blob = WebCore::Blob::create(blobValueInner); arg0->append(toStringCopy(*arg2), blob, toStringCopy(*fileName)); } -CPP_DECL size_t WebCore__DOMFormData__count(WebCore__DOMFormData* arg0) +CPP_DECL size_t WebCore__DOMFormData__count(WebCore::DOMFormData* arg0) { return arg0->count(); } @@ -6173,7 +6161,7 @@ extern "C" void DOMFormData__toQueryString( callback(ctx, &encoded); } -CPP_DECL JSC__JSValue WebCore__DOMFormData__createFromURLQuery(JSC__JSGlobalObject* arg0, ZigString* arg1) +CPP_DECL JSC::EncodedJSValue WebCore__DOMFormData__createFromURLQuery(JSC::JSGlobalObject* arg0, ZigString* arg1) { Zig::GlobalObject* globalObject = reinterpret_cast(arg0); // don't need to copy the string because it internally does. @@ -6181,47 +6169,47 @@ CPP_DECL JSC__JSValue WebCore__DOMFormData__createFromURLQuery(JSC__JSGlobalObje return JSValue::encode(toJSNewlyCreated(arg0, globalObject, WTFMove(formData))); } -CPP_DECL JSC__JSValue WebCore__DOMFormData__create(JSC__JSGlobalObject* arg0) +CPP_DECL JSC::EncodedJSValue WebCore__DOMFormData__create(JSC::JSGlobalObject* arg0) { Zig::GlobalObject* globalObject = reinterpret_cast(arg0); auto formData = DOMFormData::create(globalObject->scriptExecutionContext()); return JSValue::encode(toJSNewlyCreated(arg0, globalObject, WTFMove(formData))); } -CPP_DECL WebCore__DOMFormData* WebCore__DOMFormData__fromJS(JSC__JSValue JSValue1) +CPP_DECL WebCore::DOMFormData* WebCore__DOMFormData__fromJS(JSC::EncodedJSValue JSValue1) { - return WebCoreCast(JSValue1); + return WebCoreCast(JSValue1); } #pragma mark - JSC::JSMap -CPP_DECL JSC__JSValue JSC__JSMap__create(JSC__JSGlobalObject* arg0) +CPP_DECL JSC::EncodedJSValue JSC__JSMap__create(JSC::JSGlobalObject* arg0) { JSC::JSMap* map = JSC::JSMap::create(arg0->vm(), arg0->mapStructure()); return JSC::JSValue::encode(map); } -CPP_DECL JSC__JSValue JSC__JSMap__get_(JSC__JSMap* map, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2) +CPP_DECL JSC::EncodedJSValue JSC__JSMap__get_(JSC::JSMap* map, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2) { JSC::JSValue value = JSC::JSValue::decode(JSValue2); return JSC::JSValue::encode(map->get(arg1, value)); } -CPP_DECL bool JSC__JSMap__has(JSC__JSMap* map, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2) +CPP_DECL bool JSC__JSMap__has(JSC::JSMap* map, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2) { JSC::JSValue value = JSC::JSValue::decode(JSValue2); return map->has(arg1, value); } -CPP_DECL bool JSC__JSMap__remove(JSC__JSMap* map, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2) +CPP_DECL bool JSC__JSMap__remove(JSC::JSMap* map, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2) { JSC::JSValue value = JSC::JSValue::decode(JSValue2); return map->remove(arg1, value); } -CPP_DECL void JSC__JSMap__set(JSC__JSMap* map, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2, JSC__JSValue JSValue3) +CPP_DECL void JSC__JSMap__set(JSC::JSMap* map, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2, JSC::EncodedJSValue JSValue3) { map->set(arg1, JSC::JSValue::decode(JSValue2), JSC::JSValue::decode(JSValue3)); } -CPP_DECL void JSC__VM__setControlFlowProfiler(JSC__VM* vm, bool isEnabled) +CPP_DECL void JSC__VM__setControlFlowProfiler(JSC::VM* vm, bool isEnabled) { if (isEnabled) { vm->enableControlFlowProfiler(); @@ -6230,7 +6218,7 @@ CPP_DECL void JSC__VM__setControlFlowProfiler(JSC__VM* vm, bool isEnabled) } } -CPP_DECL void JSC__VM__performOpportunisticallyScheduledTasks(JSC__VM* vm, double until) +CPP_DECL void JSC__VM__performOpportunisticallyScheduledTasks(JSC::VM* vm, double until) { vm->performOpportunisticallyScheduledTasks(MonotonicTime::now() + Seconds(until), {}); } @@ -6332,27 +6320,27 @@ extern "C" JSC::EncodedJSValue JSGlobalObject__tryTakeException(JSC::JSGlobalObj return {}; } -CPP_DECL bool JSC__GetterSetter__isGetterNull(JSC__GetterSetter* gettersetter) +CPP_DECL bool JSC__GetterSetter__isGetterNull(JSC::GetterSetter* gettersetter) { return gettersetter->isGetterNull(); } -CPP_DECL bool JSC__GetterSetter__isSetterNull(JSC__GetterSetter* gettersetter) +CPP_DECL bool JSC__GetterSetter__isSetterNull(JSC::GetterSetter* gettersetter) { return gettersetter->isSetterNull(); } -CPP_DECL bool JSC__CustomGetterSetter__isGetterNull(JSC__CustomGetterSetter* gettersetter) +CPP_DECL bool JSC__CustomGetterSetter__isGetterNull(JSC::CustomGetterSetter* gettersetter) { return gettersetter->getter() == nullptr; } -CPP_DECL bool JSC__CustomGetterSetter__isSetterNull(JSC__CustomGetterSetter* gettersetter) +CPP_DECL bool JSC__CustomGetterSetter__isSetterNull(JSC::CustomGetterSetter* gettersetter) { return gettersetter->setter() == nullptr; } -CPP_DECL JSC__JSValue Bun__ProxyObject__getInternalField(JSC__JSValue value, uint32_t id) +CPP_DECL JSC::EncodedJSValue Bun__ProxyObject__getInternalField(JSC::EncodedJSValue value, uint32_t id) { return JSValue::encode(jsCast(JSValue::decode(value))->internalField((ProxyObject::Field)id).get()); } diff --git a/src/bun.js/bindings/headers-cpp.h b/src/bun.js/bindings/headers-cpp.h index 8b5f146b51..50e4c3d7c4 100644 --- a/src/bun.js/bindings/headers-cpp.h +++ b/src/bun.js/bindings/headers-cpp.h @@ -192,6 +192,4 @@ extern "C" const size_t Bun__BodyValueBufferer_object_align_ = alignof(Bun__Body const size_t sizes[39] = {sizeof(JSC::JSObject), sizeof(WebCore::DOMURL), sizeof(WebCore::DOMFormData), sizeof(WebCore::FetchHeaders), sizeof(SystemError), sizeof(JSC::JSCell), sizeof(JSC::JSString), sizeof(JSC::JSModuleLoader), sizeof(WebCore::AbortSignal), sizeof(JSC::JSPromise), sizeof(JSC::JSInternalPromise), sizeof(JSC::JSFunction), sizeof(JSC::JSGlobalObject), sizeof(JSC::JSMap), sizeof(JSC::JSValue), sizeof(JSC::Exception), sizeof(JSC::VM), sizeof(JSC::ThrowScope), sizeof(JSC::CatchScope), sizeof(FFI__ptr), sizeof(Reader__u8), sizeof(Reader__u16), sizeof(Reader__u32), sizeof(Reader__ptr), sizeof(Reader__i8), sizeof(Reader__i16), sizeof(Reader__i32), sizeof(Reader__f32), sizeof(Reader__f64), sizeof(Reader__i64), sizeof(Reader__u64), sizeof(Reader__intptr), sizeof(Zig::GlobalObject), sizeof(Bun__Path), sizeof(ArrayBufferSink), sizeof(HTTPSResponseSink), sizeof(HTTPResponseSink), sizeof(FileSink), sizeof(FileSink)}; -const char* names[39] = {"JSC__JSObject", "WebCore__DOMURL", "WebCore__DOMFormData", "WebCore__FetchHeaders", "SystemError", "JSC__JSCell", "JSC__JSString", "JSC__JSModuleLoader", "WebCore__AbortSignal", "JSC__JSPromise", "JSC__JSInternalPromise", "JSC__JSFunction", "JSC__JSGlobalObject", "JSC__JSMap", "JSC__JSValue", "JSC__Exception", "JSC__VM", "JSC__ThrowScope", "JSC__CatchScope", "FFI__ptr", "Reader__u8", "Reader__u16", "Reader__u32", "Reader__ptr", "Reader__i8", "Reader__i16", "Reader__i32", "Reader__f32", "Reader__f64", "Reader__i64", "Reader__u64", "Reader__intptr", "Zig__GlobalObject", "Bun__Path", "ArrayBufferSink", "HTTPSResponseSink", "HTTPResponseSink", "FileSink", "FileSink"}; - const size_t aligns[39] = {alignof(JSC::JSObject), alignof(WebCore::DOMURL), alignof(WebCore::DOMFormData), alignof(WebCore::FetchHeaders), alignof(SystemError), alignof(JSC::JSCell), alignof(JSC::JSString), alignof(JSC::JSModuleLoader), alignof(WebCore::AbortSignal), alignof(JSC::JSPromise), alignof(JSC::JSInternalPromise), alignof(JSC::JSFunction), alignof(JSC::JSGlobalObject), alignof(JSC::JSMap), alignof(JSC::JSValue), alignof(JSC::Exception), alignof(JSC::VM), alignof(JSC::ThrowScope), alignof(JSC::CatchScope), alignof(FFI__ptr), alignof(Reader__u8), alignof(Reader__u16), alignof(Reader__u32), alignof(Reader__ptr), alignof(Reader__i8), alignof(Reader__i16), alignof(Reader__i32), alignof(Reader__f32), alignof(Reader__f64), alignof(Reader__i64), alignof(Reader__u64), alignof(Reader__intptr), alignof(Zig::GlobalObject), alignof(Bun__Path), alignof(ArrayBufferSink), alignof(HTTPSResponseSink), alignof(HTTPResponseSink), alignof(FileSink), alignof(FileSink)}; diff --git a/src/bun.js/bindings/headers-handwritten.h b/src/bun.js/bindings/headers-handwritten.h index b568fab6be..421c568f71 100644 --- a/src/bun.js/bindings/headers-handwritten.h +++ b/src/bun.js/bindings/headers-handwritten.h @@ -281,7 +281,7 @@ typedef void WebSocketClientTLS; #ifndef __cplusplus typedef struct Bun__ArrayBuffer Bun__ArrayBuffer; -typedef struct Uint8Array_alias Uint8Array_alias; +typedef struct JSC::JSUint8Array JSC::JSUint8Array; #endif #ifdef __cplusplus @@ -310,8 +310,6 @@ BunString toStringRef(WTF::StringImpl* wtfString); BunString toStringView(WTF::StringView view); } -using Uint8Array_alias = JSC::JSUint8Array; - typedef struct { char* ptr; size_t offset; diff --git a/src/bun.js/bindings/headers.h b/src/bun.js/bindings/headers.h index 9dccdc7915..9af6a67850 100644 --- a/src/bun.js/bindings/headers.h +++ b/src/bun.js/bindings/headers.h @@ -6,594 +6,485 @@ #include #include -#ifdef __cplusplus - #define AUTO_EXTERN_C extern "C" - #ifdef WIN32 - #define AUTO_EXTERN_C_ZIG extern "C" - #else - #define AUTO_EXTERN_C_ZIG extern "C" __attribute__((weak)) - #endif +#define AUTO_EXTERN_C extern "C" +#ifdef WIN32 + #define AUTO_EXTERN_C_ZIG extern "C" #else - #define AUTO_EXTERN_C - #define AUTO_EXTERN_C_ZIG __attribute__((weak)) + #define AUTO_EXTERN_C_ZIG extern "C" __attribute__((weak)) #endif + #define ZIG_DECL AUTO_EXTERN_C_ZIG #define CPP_DECL AUTO_EXTERN_C #define CPP_SIZE AUTO_EXTERN_C -#ifndef __cplusplus -typedef void* JSClassRef; -#endif - -#ifdef __cplusplus #include "root.h" #include -#endif #include "headers-handwritten.h" - typedef struct bJSC__JSPromise { unsigned char bytes[32]; } bJSC__JSPromise; - typedef char* bJSC__JSPromise_buf; - typedef struct bJSC__JSCell { unsigned char bytes[8]; } bJSC__JSCell; - typedef char* bJSC__JSCell_buf; - typedef struct bJSC__Exception { unsigned char bytes[40]; } bJSC__Exception; - typedef char* bJSC__Exception_buf; - typedef struct bJSC__JSObject { unsigned char bytes[16]; } bJSC__JSObject; - typedef char* bJSC__JSObject_buf; - typedef struct bJSC__ThrowScope { unsigned char bytes[8]; } bJSC__ThrowScope; - typedef char* bJSC__ThrowScope_buf; - typedef struct bJSC__CatchScope { unsigned char bytes[8]; } bJSC__CatchScope; - typedef char* bJSC__CatchScope_buf; - typedef struct bJSC__JSString { unsigned char bytes[16]; } bJSC__JSString; - typedef char* bJSC__JSString_buf; - typedef struct bJSC__JSInternalPromise { unsigned char bytes[32]; } bJSC__JSInternalPromise; - typedef char* bJSC__JSInternalPromise_buf; - typedef struct bJSC__JSGlobalObject { unsigned char bytes[3128]; } bJSC__JSGlobalObject; - typedef char* bJSC__JSGlobalObject_buf; - typedef struct bJSC__VM { unsigned char bytes[52176]; } bJSC__VM; - typedef char* bJSC__VM_buf; - -#ifndef __cplusplus - typedef Bun__ArrayBuffer Bun__ArrayBuffer; - typedef bJSC__JSString JSC__JSString; // JSC::JSString - typedef BunString BunString; - typedef int64_t JSC__JSValue; - typedef ZigString ZigString; - typedef struct WebCore__DOMFormData WebCore__DOMFormData; // WebCore::DOMFormData - typedef struct WebCore__DOMURL WebCore__DOMURL; // WebCore::DOMURL - typedef struct WebCore__FetchHeaders WebCore__FetchHeaders; // WebCore::FetchHeaders - typedef ErrorableResolvedSource ErrorableResolvedSource; - typedef bJSC__JSPromise JSC__JSPromise; // JSC::JSPromise - typedef bJSC__VM JSC__VM; // JSC::VM - typedef bJSC__CatchScope JSC__CatchScope; // JSC::CatchScope - typedef ZigException ZigException; - typedef struct JSC__CallFrame JSC__CallFrame; // JSC::CallFrame - typedef bJSC__ThrowScope JSC__ThrowScope; // JSC::ThrowScope - typedef bJSC__Exception JSC__Exception; // JSC::Exception - typedef WebSocketHTTPClient WebSocketHTTPClient; - typedef WebSocketClient WebSocketClient; - typedef WebSocketClientTLS WebSocketClientTLS; - typedef ErrorableString ErrorableString; - typedef bJSC__JSObject JSC__JSObject; // JSC::JSObject - typedef struct JSC__JSMap JSC__JSMap; // JSC::JSMap - typedef SystemError SystemError; - typedef Uint8Array_alias Uint8Array_alias; - typedef bJSC__JSCell JSC__JSCell; // JSC::JSCell - typedef bJSC__JSGlobalObject JSC__JSGlobalObject; // JSC::JSGlobalObject - typedef struct WebCore__AbortSignal WebCore__AbortSignal; // WebCore::AbortSignal - typedef bJSC__JSInternalPromise JSC__JSInternalPromise; // JSC::JSInternalPromise - typedef WebSocketHTTPSClient WebSocketHTTPSClient; - -#endif - -#ifdef __cplusplus - namespace JSC { - class JSGlobalObject; - class Exception; - class JSObject; - class JSInternalPromise; - class JSString; - class JSCell; - class JSMap; - class JSPromise; - class CatchScope; - class VM; - class ThrowScope; - class CallFrame; - } - namespace WebCore { - class FetchHeaders; - class DOMFormData; - class AbortSignal; - class DOMURL; - } - - typedef Bun__ArrayBuffer Bun__ArrayBuffer; - typedef BunString BunString; - typedef int64_t JSC__JSValue; - typedef ZigString ZigString; - typedef ErrorableResolvedSource ErrorableResolvedSource; - typedef ZigException ZigException; - typedef WebSocketHTTPClient WebSocketHTTPClient; - typedef WebSocketClient WebSocketClient; - typedef WebSocketClientTLS WebSocketClientTLS; - typedef ErrorableString ErrorableString; - typedef SystemError SystemError; - typedef Uint8Array_alias Uint8Array_alias; - typedef WebSocketHTTPSClient WebSocketHTTPSClient; - using JSC__JSGlobalObject = JSC::JSGlobalObject; - using JSC__Exception = JSC::Exception; - using JSC__JSObject = JSC::JSObject; - using JSC__JSInternalPromise = JSC::JSInternalPromise; - using JSC__JSString = JSC::JSString; - using JSC__JSCell = JSC::JSCell; - using JSC__JSMap = JSC::JSMap; - using JSC__JSPromise = JSC::JSPromise; - using JSC__CatchScope = JSC::CatchScope; - using JSC__VM = JSC::VM; - using JSC__ThrowScope = JSC::ThrowScope; - using JSC__CallFrame = JSC::CallFrame; - using WebCore__FetchHeaders = WebCore::FetchHeaders; - using WebCore__DOMFormData = WebCore::DOMFormData; - using WebCore__AbortSignal = WebCore::AbortSignal; - using WebCore__DOMURL = WebCore::DOMURL; - - using JSC__GetterSetter = JSC::GetterSetter; - using JSC__CustomGetterSetter = JSC::CustomGetterSetter; -#endif +namespace JSC { +class JSGlobalObject; +class Exception; +class JSObject; +class JSInternalPromise; +class JSString; +class JSCell; +class JSMap; +class JSPromise; +class CatchScope; +class VM; +class ThrowScope; +class CallFrame; +} +namespace WebCore { +class FetchHeaders; +class DOMFormData; +class AbortSignal; +class DOMURL; +} #pragma mark - JSC::JSObject -CPP_DECL JSC__JSValue JSC__JSObject__create(JSC__JSGlobalObject* arg0, size_t arg1, void* arg2, void(* ArgFn3)(void* arg0, JSC__JSObject* arg1, JSC__JSGlobalObject* arg2)); -CPP_DECL size_t JSC__JSObject__getArrayLength(JSC__JSObject* arg0); -CPP_DECL JSC__JSValue JSC__JSObject__getDirect(JSC__JSObject* arg0, JSC__JSGlobalObject* arg1, const ZigString* arg2); -CPP_DECL JSC__JSValue JSC__JSObject__getIndex(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, uint32_t arg2); -CPP_DECL void JSC__JSObject__putRecord(JSC__JSObject* arg0, JSC__JSGlobalObject* arg1, ZigString* arg2, ZigString* arg3, size_t arg4); -CPP_DECL JSC__JSValue ZigString__external(const ZigString* arg0, JSC__JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(void* arg0, void* arg1, size_t arg2)); -CPP_DECL JSC__JSValue ZigString__to16BitValue(const ZigString* arg0, JSC__JSGlobalObject* arg1); -CPP_DECL JSC__JSValue ZigString__toAtomicValue(const ZigString* arg0, JSC__JSGlobalObject* arg1); -CPP_DECL JSC__JSValue ZigString__toErrorInstance(const ZigString* arg0, JSC__JSGlobalObject* arg1); -CPP_DECL JSC__JSValue ZigString__toExternalU16(const uint16_t* arg0, size_t arg1, JSC__JSGlobalObject* arg2); -CPP_DECL JSC__JSValue ZigString__toExternalValue(const ZigString* arg0, JSC__JSGlobalObject* arg1); -CPP_DECL JSC__JSValue ZigString__toExternalValueWithCallback(const ZigString* arg0, JSC__JSGlobalObject* arg1, void(* ArgFn2)(void* arg0, void* arg1, size_t arg2)); -CPP_DECL JSC__JSValue ZigString__toRangeErrorInstance(const ZigString* arg0, JSC__JSGlobalObject* arg1); -CPP_DECL JSC__JSValue ZigString__toSyntaxErrorInstance(const ZigString* arg0, JSC__JSGlobalObject* arg1); -CPP_DECL JSC__JSValue ZigString__toTypeErrorInstance(const ZigString* arg0, JSC__JSGlobalObject* arg1); -CPP_DECL JSC__JSValue ZigString__toValueGC(const ZigString* arg0, JSC__JSGlobalObject* arg1); -CPP_DECL WebCore__DOMURL* WebCore__DOMURL__cast_(JSC__JSValue JSValue0, JSC__VM* arg1); -CPP_DECL BunString WebCore__DOMURL__fileSystemPath(WebCore__DOMURL* arg0, int* errorCode); -CPP_DECL void WebCore__DOMURL__href_(WebCore__DOMURL* arg0, ZigString* arg1); -CPP_DECL void WebCore__DOMURL__pathname_(WebCore__DOMURL* arg0, ZigString* arg1); +CPP_DECL JSC::EncodedJSValue JSC__JSObject__create(JSC::JSGlobalObject* arg0, size_t arg1, void* arg2, void(* ArgFn3)(void* arg0, JSC::JSObject* arg1, JSC::JSGlobalObject* arg2)); +CPP_DECL size_t JSC__JSObject__getArrayLength(JSC::JSObject* arg0); +CPP_DECL JSC::EncodedJSValue JSC__JSObject__getDirect(JSC::JSObject* arg0, JSC::JSGlobalObject* arg1, const ZigString* arg2); +CPP_DECL JSC::EncodedJSValue JSC__JSObject__getIndex(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, uint32_t arg2); +CPP_DECL void JSC__JSObject__putRecord(JSC::JSObject* arg0, JSC::JSGlobalObject* arg1, ZigString* arg2, ZigString* arg3, size_t arg4); +CPP_DECL JSC::EncodedJSValue ZigString__external(const ZigString* arg0, JSC::JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(void* arg0, void* arg1, size_t arg2)); +CPP_DECL JSC::EncodedJSValue ZigString__to16BitValue(const ZigString* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL JSC::EncodedJSValue ZigString__toAtomicValue(const ZigString* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL JSC::EncodedJSValue ZigString__toErrorInstance(const ZigString* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL JSC::EncodedJSValue ZigString__toExternalU16(const uint16_t* arg0, size_t arg1, JSC::JSGlobalObject* arg2); +CPP_DECL JSC::EncodedJSValue ZigString__toExternalValue(const ZigString* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL JSC::EncodedJSValue ZigString__toExternalValueWithCallback(const ZigString* arg0, JSC::JSGlobalObject* arg1, void(* ArgFn2)(void* arg0, void* arg1, size_t arg2)); +CPP_DECL JSC::EncodedJSValue ZigString__toRangeErrorInstance(const ZigString* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL JSC::EncodedJSValue ZigString__toSyntaxErrorInstance(const ZigString* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL JSC::EncodedJSValue ZigString__toTypeErrorInstance(const ZigString* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL JSC::EncodedJSValue ZigString__toValueGC(const ZigString* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL WebCore::DOMURL* WebCore__DOMURL__cast_(JSC::EncodedJSValue JSValue0, JSC::VM* arg1); +CPP_DECL BunString WebCore__DOMURL__fileSystemPath(WebCore::DOMURL* arg0, int* errorCode); +CPP_DECL void WebCore__DOMURL__href_(WebCore::DOMURL* arg0, ZigString* arg1); +CPP_DECL void WebCore__DOMURL__pathname_(WebCore::DOMURL* arg0, ZigString* arg1); #pragma mark - WebCore::DOMFormData -CPP_DECL void WebCore__DOMFormData__append(WebCore__DOMFormData* arg0, ZigString* arg1, ZigString* arg2); -CPP_DECL void WebCore__DOMFormData__appendBlob(WebCore__DOMFormData* arg0, JSC__JSGlobalObject* arg1, ZigString* arg2, void* arg3, ZigString* arg4); -CPP_DECL size_t WebCore__DOMFormData__count(WebCore__DOMFormData* arg0); -CPP_DECL JSC__JSValue WebCore__DOMFormData__create(JSC__JSGlobalObject* arg0); -CPP_DECL JSC__JSValue WebCore__DOMFormData__createFromURLQuery(JSC__JSGlobalObject* arg0, ZigString* arg1); -CPP_DECL WebCore__DOMFormData* _fromJS(JSC__JSValue JSValue0); +CPP_DECL void WebCore__DOMFormData__append(WebCore::DOMFormData* arg0, ZigString* arg1, ZigString* arg2); +CPP_DECL void WebCore__DOMFormData__appendBlob(WebCore::DOMFormData* arg0, JSC::JSGlobalObject* arg1, ZigString* arg2, void* arg3, ZigString* arg4); +CPP_DECL size_t WebCore__DOMFormData__count(WebCore::DOMFormData* arg0); +CPP_DECL JSC::EncodedJSValue WebCore__DOMFormData__create(JSC::JSGlobalObject* arg0); +CPP_DECL JSC::EncodedJSValue WebCore__DOMFormData__createFromURLQuery(JSC::JSGlobalObject* arg0, ZigString* arg1); +CPP_DECL WebCore::DOMFormData* _fromJS(JSC::EncodedJSValue JSValue0); #pragma mark - WebCore::FetchHeaders -CPP_DECL void WebCore__FetchHeaders__append(WebCore__FetchHeaders* arg0, const ZigString* arg1, const ZigString* arg2, JSC__JSGlobalObject* arg3); -CPP_DECL WebCore__FetchHeaders* WebCore__FetchHeaders__cast_(JSC__JSValue JSValue0, JSC__VM* arg1); -CPP_DECL JSC__JSValue WebCore__FetchHeaders__clone(WebCore__FetchHeaders* arg0, JSC__JSGlobalObject* arg1); -CPP_DECL WebCore__FetchHeaders* WebCore__FetchHeaders__cloneThis(WebCore__FetchHeaders* arg0, JSC__JSGlobalObject* arg1); -CPP_DECL void WebCore__FetchHeaders__copyTo(WebCore__FetchHeaders* arg0, StringPointer* arg1, StringPointer* arg2, unsigned char* arg3); -CPP_DECL void WebCore__FetchHeaders__count(WebCore__FetchHeaders* arg0, uint32_t* arg1, uint32_t* arg2); -CPP_DECL WebCore__FetchHeaders* WebCore__FetchHeaders__createEmpty(); -CPP_DECL WebCore__FetchHeaders* WebCore__FetchHeaders__createFromJS(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); -CPP_DECL WebCore__FetchHeaders* WebCore__FetchHeaders__createFromPicoHeaders_(const void* arg0); -CPP_DECL WebCore__FetchHeaders* WebCore__FetchHeaders__createFromUWS(void* arg1); -CPP_DECL JSC__JSValue WebCore__FetchHeaders__createValue(JSC__JSGlobalObject* arg0, StringPointer* arg1, StringPointer* arg2, const ZigString* arg3, uint32_t arg4); -CPP_DECL void WebCore__FetchHeaders__deref(WebCore__FetchHeaders* arg0); -CPP_DECL void WebCore__FetchHeaders__fastGet_(WebCore__FetchHeaders* arg0, unsigned char arg1, ZigString* arg2); -CPP_DECL bool WebCore__FetchHeaders__fastHas_(WebCore__FetchHeaders* arg0, unsigned char arg1); -CPP_DECL void WebCore__FetchHeaders__fastRemove_(WebCore__FetchHeaders* arg0, unsigned char arg1); -CPP_DECL void WebCore__FetchHeaders__get_(WebCore__FetchHeaders* arg0, const ZigString* arg1, ZigString* arg2, JSC__JSGlobalObject* arg3); -CPP_DECL bool WebCore__FetchHeaders__has(WebCore__FetchHeaders* arg0, const ZigString* arg1, JSC__JSGlobalObject* arg2); -CPP_DECL bool WebCore__FetchHeaders__isEmpty(WebCore__FetchHeaders* arg0); -CPP_DECL void WebCore__FetchHeaders__remove(WebCore__FetchHeaders* arg0, const ZigString* arg1, JSC__JSGlobalObject* arg2); -CPP_DECL JSC__JSValue WebCore__FetchHeaders__toJS(WebCore__FetchHeaders* arg0, JSC__JSGlobalObject* arg1); -CPP_DECL void WebCore__FetchHeaders__toUWSResponse(WebCore__FetchHeaders* arg0, bool arg1, void* arg2); -CPP_DECL JSC__JSValue SystemError__toErrorInstance(const SystemError* arg0, JSC__JSGlobalObject* arg1); +CPP_DECL void WebCore__FetchHeaders__append(WebCore::FetchHeaders* arg0, const ZigString* arg1, const ZigString* arg2, JSC::JSGlobalObject* arg3); +CPP_DECL WebCore::FetchHeaders* WebCore__FetchHeaders__cast_(JSC::EncodedJSValue JSValue0, JSC::VM* arg1); +CPP_DECL JSC::EncodedJSValue WebCore__FetchHeaders__clone(WebCore::FetchHeaders* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL WebCore::FetchHeaders* WebCore__FetchHeaders__cloneThis(WebCore::FetchHeaders* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL void WebCore__FetchHeaders__copyTo(WebCore::FetchHeaders* arg0, StringPointer* arg1, StringPointer* arg2, unsigned char* arg3); +CPP_DECL void WebCore__FetchHeaders__count(WebCore::FetchHeaders* arg0, uint32_t* arg1, uint32_t* arg2); +CPP_DECL WebCore::FetchHeaders* WebCore__FetchHeaders__createEmpty(); +CPP_DECL WebCore::FetchHeaders* WebCore__FetchHeaders__createFromJS(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); +CPP_DECL WebCore::FetchHeaders* WebCore__FetchHeaders__createFromPicoHeaders_(const void* arg0); +CPP_DECL WebCore::FetchHeaders* WebCore__FetchHeaders__createFromUWS(void* arg1); +CPP_DECL JSC::EncodedJSValue WebCore__FetchHeaders__createValue(JSC::JSGlobalObject* arg0, StringPointer* arg1, StringPointer* arg2, const ZigString* arg3, uint32_t arg4); +CPP_DECL void WebCore__FetchHeaders__deref(WebCore::FetchHeaders* arg0); +CPP_DECL void WebCore__FetchHeaders__fastGet_(WebCore::FetchHeaders* arg0, unsigned char arg1, ZigString* arg2); +CPP_DECL bool WebCore__FetchHeaders__fastHas_(WebCore::FetchHeaders* arg0, unsigned char arg1); +CPP_DECL void WebCore__FetchHeaders__fastRemove_(WebCore::FetchHeaders* arg0, unsigned char arg1); +CPP_DECL void WebCore__FetchHeaders__get_(WebCore::FetchHeaders* arg0, const ZigString* arg1, ZigString* arg2, JSC::JSGlobalObject* arg3); +CPP_DECL bool WebCore__FetchHeaders__has(WebCore::FetchHeaders* arg0, const ZigString* arg1, JSC::JSGlobalObject* arg2); +CPP_DECL bool WebCore__FetchHeaders__isEmpty(WebCore::FetchHeaders* arg0); +CPP_DECL void WebCore__FetchHeaders__remove(WebCore::FetchHeaders* arg0, const ZigString* arg1, JSC::JSGlobalObject* arg2); +CPP_DECL JSC::EncodedJSValue WebCore__FetchHeaders__toJS(WebCore::FetchHeaders* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL void WebCore__FetchHeaders__toUWSResponse(WebCore::FetchHeaders* arg0, bool arg1, void* arg2); +CPP_DECL JSC::EncodedJSValue SystemError__toErrorInstance(const SystemError* arg0, JSC::JSGlobalObject* arg1); #pragma mark - JSC::JSCell -CPP_DECL JSC__JSObject* JSC__JSCell__getObject(JSC__JSCell* arg0); -CPP_DECL unsigned char JSC__JSCell__getType(JSC__JSCell* arg0); -CPP_DECL JSC__JSObject* JSC__JSCell__toObject(JSC__JSCell* cell, JSC__JSGlobalObject* globalObject); +CPP_DECL JSC::JSObject* JSC__JSCell__getObject(JSC::JSCell* arg0); +CPP_DECL unsigned char JSC__JSCell__getType(JSC::JSCell* arg0); +CPP_DECL JSC::JSObject* JSC__JSCell__toObject(JSC::JSCell* cell, JSC::JSGlobalObject* globalObject); #pragma mark - JSC::JSString -CPP_DECL bool JSC__JSString__eql(const JSC__JSString* arg0, JSC__JSGlobalObject* arg1, JSC__JSString* arg2); -CPP_DECL bool JSC__JSString__is8Bit(const JSC__JSString* arg0); -CPP_DECL void JSC__JSString__iterator(JSC__JSString* arg0, JSC__JSGlobalObject* arg1, void* arg2); -CPP_DECL size_t JSC__JSString__length(const JSC__JSString* arg0); -CPP_DECL JSC__JSObject* JSC__JSString__toObject(JSC__JSString* arg0, JSC__JSGlobalObject* arg1); -CPP_DECL void JSC__JSString__toZigString(JSC__JSString* arg0, JSC__JSGlobalObject* arg1, ZigString* arg2); +CPP_DECL bool JSC__JSString__eql(const JSC::JSString* arg0, JSC::JSGlobalObject* arg1, JSC::JSString* arg2); +CPP_DECL bool JSC__JSString__is8Bit(const JSC::JSString* arg0); +CPP_DECL void JSC__JSString__iterator(JSC::JSString* arg0, JSC::JSGlobalObject* arg1, void* arg2); +CPP_DECL size_t JSC__JSString__length(const JSC::JSString* arg0); +CPP_DECL JSC::JSObject* JSC__JSString__toObject(JSC::JSString* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL void JSC__JSString__toZigString(JSC::JSString* arg0, JSC::JSGlobalObject* arg1, ZigString* arg2); #pragma mark - JSC::JSModuleLoader -CPP_DECL JSC__JSValue JSC__JSModuleLoader__evaluate(JSC__JSGlobalObject* arg0, const unsigned char* arg1, size_t arg2, const unsigned char* arg3, size_t arg4, const unsigned char* arg5, size_t arg6, JSC__JSValue JSValue7, JSC__JSValue* arg8); -CPP_DECL JSC__JSInternalPromise* JSC__JSModuleLoader__loadAndEvaluateModule(JSC__JSGlobalObject* arg0, const BunString* arg1); +CPP_DECL JSC::EncodedJSValue JSC__JSModuleLoader__evaluate(JSC::JSGlobalObject* arg0, const unsigned char* arg1, size_t arg2, const unsigned char* arg3, size_t arg4, const unsigned char* arg5, size_t arg6, JSC::EncodedJSValue JSValue7, JSC::EncodedJSValue* arg8); +CPP_DECL JSC::JSInternalPromise* JSC__JSModuleLoader__loadAndEvaluateModule(JSC::JSGlobalObject* arg0, const BunString* arg1); #pragma mark - WebCore::AbortSignal -CPP_DECL bool WebCore__AbortSignal__aborted(WebCore__AbortSignal* arg0); -CPP_DECL JSC__JSValue WebCore__AbortSignal__abortReason(WebCore__AbortSignal* arg0); -CPP_DECL WebCore__AbortSignal* WebCore__AbortSignal__addListener(WebCore__AbortSignal* arg0, void* arg1, void(* ArgFn2)(void* arg0, JSC__JSValue JSValue1)); -CPP_DECL void WebCore__AbortSignal__cleanNativeBindings(WebCore__AbortSignal* arg0, void* arg1); -CPP_DECL JSC__JSValue WebCore__AbortSignal__create(JSC__JSGlobalObject* arg0); -CPP_DECL WebCore__AbortSignal* WebCore__AbortSignal__fromJS(JSC__JSValue JSValue0); -CPP_DECL WebCore__AbortSignal* WebCore__AbortSignal__ref(WebCore__AbortSignal* arg0); -CPP_DECL WebCore__AbortSignal* WebCore__AbortSignal__signal(WebCore__AbortSignal* arg0, JSC__JSGlobalObject*, uint8_t abortReason); -CPP_DECL JSC__JSValue WebCore__AbortSignal__toJS(WebCore__AbortSignal* arg0, JSC__JSGlobalObject* arg1); -CPP_DECL void WebCore__AbortSignal__unref(WebCore__AbortSignal* arg0); +CPP_DECL bool WebCore__AbortSignal__aborted(WebCore::AbortSignal* arg0); +CPP_DECL JSC::EncodedJSValue WebCore__AbortSignal__abortReason(WebCore::AbortSignal* arg0); +CPP_DECL WebCore::AbortSignal* WebCore__AbortSignal__addListener(WebCore::AbortSignal* arg0, void* arg1, void(* ArgFn2)(void* arg0, JSC::EncodedJSValue JSValue1)); +CPP_DECL void WebCore__AbortSignal__cleanNativeBindings(WebCore::AbortSignal* arg0, void* arg1); +CPP_DECL JSC::EncodedJSValue WebCore__AbortSignal__create(JSC::JSGlobalObject* arg0); +CPP_DECL WebCore::AbortSignal* WebCore__AbortSignal__fromJS(JSC::EncodedJSValue JSValue0); +CPP_DECL WebCore::AbortSignal* WebCore__AbortSignal__ref(WebCore::AbortSignal* arg0); +CPP_DECL WebCore::AbortSignal* WebCore__AbortSignal__signal(WebCore::AbortSignal* arg0, JSC::JSGlobalObject*, uint8_t abortReason); +CPP_DECL JSC::EncodedJSValue WebCore__AbortSignal__toJS(WebCore::AbortSignal* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL void WebCore__AbortSignal__unref(WebCore::AbortSignal* arg0); #pragma mark - JSC::JSPromise -CPP_DECL JSC__JSValue JSC__JSPromise__asValue(JSC__JSPromise* arg0, JSC__JSGlobalObject* arg1); -CPP_DECL JSC__JSPromise* JSC__JSPromise__create(JSC__JSGlobalObject* arg0); -CPP_DECL bool JSC__JSPromise__isHandled(const JSC__JSPromise* arg0, JSC__VM* arg1); -CPP_DECL void JSC__JSPromise__reject(JSC__JSPromise* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); -CPP_DECL void JSC__JSPromise__rejectAsHandled(JSC__JSPromise* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); -CPP_DECL void JSC__JSPromise__rejectAsHandledException(JSC__JSPromise* arg0, JSC__JSGlobalObject* arg1, JSC__Exception* arg2); -CPP_DECL JSC__JSPromise* JSC__JSPromise__rejectedPromise(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); -CPP_DECL JSC__JSValue JSC__JSPromise__rejectedPromiseValue(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); -CPP_DECL void JSC__JSPromise__rejectOnNextTickWithHandled(JSC__JSPromise* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2, bool arg3); -CPP_DECL void JSC__JSPromise__resolve(JSC__JSPromise* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); -CPP_DECL JSC__JSPromise* JSC__JSPromise__resolvedPromise(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); -CPP_DECL JSC__JSValue JSC__JSPromise__resolvedPromiseValue(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); -CPP_DECL JSC__JSValue JSC__JSPromise__result(JSC__JSPromise* arg0, JSC__VM* arg1); -CPP_DECL void JSC__JSPromise__setHandled(JSC__JSPromise* arg0, JSC__VM* arg1); -CPP_DECL uint32_t JSC__JSPromise__status(const JSC__JSPromise* arg0, JSC__VM* arg1); +CPP_DECL JSC::EncodedJSValue JSC__JSPromise__asValue(JSC::JSPromise* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL JSC::JSPromise* JSC__JSPromise__create(JSC::JSGlobalObject* arg0); +CPP_DECL bool JSC__JSPromise__isHandled(const JSC::JSPromise* arg0, JSC::VM* arg1); +CPP_DECL void JSC__JSPromise__reject(JSC::JSPromise* arg0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); +CPP_DECL void JSC__JSPromise__rejectAsHandled(JSC::JSPromise* arg0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); +CPP_DECL JSC::JSPromise* JSC__JSPromise__rejectedPromise(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); +CPP_DECL JSC::EncodedJSValue JSC__JSPromise__rejectedPromiseValue(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); +CPP_DECL void JSC__JSPromise__rejectOnNextTickWithHandled(JSC::JSPromise* arg0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2, bool arg3); +CPP_DECL void JSC__JSPromise__resolve(JSC::JSPromise* arg0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); +CPP_DECL JSC::JSPromise* JSC__JSPromise__resolvedPromise(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); +CPP_DECL JSC::EncodedJSValue JSC__JSPromise__resolvedPromiseValue(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); +CPP_DECL JSC::EncodedJSValue JSC__JSPromise__result(JSC::JSPromise* arg0, JSC::VM* arg1); +CPP_DECL void JSC__JSPromise__setHandled(JSC::JSPromise* arg0, JSC::VM* arg1); +CPP_DECL uint32_t JSC__JSPromise__status(const JSC::JSPromise* arg0, JSC::VM* arg1); #pragma mark - JSC::JSInternalPromise -CPP_DECL JSC__JSInternalPromise* JSC__JSInternalPromise__create(JSC__JSGlobalObject* arg0); -CPP_DECL bool JSC__JSInternalPromise__isHandled(const JSC__JSInternalPromise* arg0, JSC__VM* arg1); -CPP_DECL void JSC__JSInternalPromise__reject(JSC__JSInternalPromise* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); -CPP_DECL void JSC__JSInternalPromise__rejectAsHandled(JSC__JSInternalPromise* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); -CPP_DECL void JSC__JSInternalPromise__rejectAsHandledException(JSC__JSInternalPromise* arg0, JSC__JSGlobalObject* arg1, JSC__Exception* arg2); -CPP_DECL JSC__JSInternalPromise* JSC__JSInternalPromise__rejectedPromise(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); -CPP_DECL void JSC__JSInternalPromise__resolve(JSC__JSInternalPromise* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); -CPP_DECL JSC__JSInternalPromise* JSC__JSInternalPromise__resolvedPromise(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); -CPP_DECL JSC__JSValue JSC__JSInternalPromise__result(const JSC__JSInternalPromise* arg0, JSC__VM* arg1); -CPP_DECL void JSC__JSInternalPromise__setHandled(JSC__JSInternalPromise* arg0, JSC__VM* arg1); -CPP_DECL uint32_t JSC__JSInternalPromise__status(const JSC__JSInternalPromise* arg0, JSC__VM* arg1); +CPP_DECL JSC::JSInternalPromise* JSC__JSInternalPromise__create(JSC::JSGlobalObject* arg0); +CPP_DECL bool JSC__JSInternalPromise__isHandled(const JSC::JSInternalPromise* arg0, JSC::VM* arg1); +CPP_DECL void JSC__JSInternalPromise__reject(JSC::JSInternalPromise* arg0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); +CPP_DECL void JSC__JSInternalPromise__rejectAsHandled(JSC::JSInternalPromise* arg0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); +CPP_DECL void JSC__JSInternalPromise__rejectAsHandledException(JSC::JSInternalPromise* arg0, JSC::JSGlobalObject* arg1, JSC::Exception* arg2); +CPP_DECL JSC::JSInternalPromise* JSC__JSInternalPromise__rejectedPromise(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); +CPP_DECL void JSC__JSInternalPromise__resolve(JSC::JSInternalPromise* arg0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); +CPP_DECL JSC::JSInternalPromise* JSC__JSInternalPromise__resolvedPromise(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); +CPP_DECL JSC::EncodedJSValue JSC__JSInternalPromise__result(const JSC::JSInternalPromise* arg0, JSC::VM* arg1); +CPP_DECL void JSC__JSInternalPromise__setHandled(JSC::JSInternalPromise* arg0, JSC::VM* arg1); +CPP_DECL uint32_t JSC__JSInternalPromise__status(const JSC::JSInternalPromise* arg0, JSC::VM* arg1); #pragma mark - JSC::JSFunction -CPP_DECL void JSC__JSFunction__optimizeSoon(JSC__JSValue JSValue0); +CPP_DECL void JSC__JSFunction__optimizeSoon(JSC::EncodedJSValue JSValue0); #pragma mark - JSC::JSGlobalObject -CPP_DECL VirtualMachine* JSC__JSGlobalObject__bunVM(JSC__JSGlobalObject* arg0); -CPP_DECL JSC__JSValue JSC__JSGlobalObject__createAggregateError(JSC__JSGlobalObject* arg0, const JSC::JSValue* arg1, size_t arg2, const ZigString* arg3); -CPP_DECL void JSC__JSGlobalObject__createSyntheticModule_(JSC__JSGlobalObject* arg0, ZigString* arg1, size_t arg2, JSC__JSValue* arg3, size_t arg4); -CPP_DECL void JSC__JSGlobalObject__deleteModuleRegistryEntry(JSC__JSGlobalObject* arg0, ZigString* arg1); -CPP_DECL JSC__JSValue JSC__JSGlobalObject__generateHeapSnapshot(JSC__JSGlobalObject* arg0); -CPP_DECL JSC__JSValue JSC__JSGlobalObject__getCachedObject(JSC__JSGlobalObject* arg0, const ZigString* arg1); -CPP_DECL void JSC__JSGlobalObject__handleRejectedPromises(JSC__JSGlobalObject* arg0); -CPP_DECL JSC__JSValue JSC__JSGlobalObject__putCachedObject(JSC__JSGlobalObject* arg0, const ZigString* arg1, JSC__JSValue JSValue2); -CPP_DECL void JSC__JSGlobalObject__addGc(JSC__JSGlobalObject* globalObject); -CPP_DECL void JSC__JSGlobalObject__queueMicrotaskJob(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue JSValue2, JSC__JSValue JSValue3); -CPP_DECL void JSC__JSGlobalObject__reload(JSC__JSGlobalObject* arg0); -CPP_DECL bool JSC__JSGlobalObject__startRemoteInspector(JSC__JSGlobalObject* arg0, unsigned char* arg1, uint16_t arg2); -CPP_DECL JSC__VM* JSC__JSGlobalObject__vm(JSC__JSGlobalObject* arg0); +CPP_DECL VirtualMachine* JSC__JSGlobalObject__bunVM(JSC::JSGlobalObject* arg0); +CPP_DECL JSC::EncodedJSValue JSC__JSGlobalObject__createAggregateError(JSC::JSGlobalObject* arg0, const JSC::JSValue* arg1, size_t arg2, const ZigString* arg3); +CPP_DECL void JSC__JSGlobalObject__createSyntheticModule_(JSC::JSGlobalObject* arg0, ZigString* arg1, size_t arg2, JSC::EncodedJSValue* arg3, size_t arg4); +CPP_DECL void JSC__JSGlobalObject__deleteModuleRegistryEntry(JSC::JSGlobalObject* arg0, ZigString* arg1); +CPP_DECL JSC::EncodedJSValue JSC__JSGlobalObject__generateHeapSnapshot(JSC::JSGlobalObject* arg0); +CPP_DECL JSC::EncodedJSValue JSC__JSGlobalObject__getCachedObject(JSC::JSGlobalObject* arg0, const ZigString* arg1); +CPP_DECL void JSC__JSGlobalObject__handleRejectedPromises(JSC::JSGlobalObject* arg0); +CPP_DECL JSC::EncodedJSValue JSC__JSGlobalObject__putCachedObject(JSC::JSGlobalObject* arg0, const ZigString* arg1, JSC::EncodedJSValue JSValue2); +CPP_DECL void JSC__JSGlobalObject__addGc(JSC::JSGlobalObject* globalObject); +CPP_DECL void JSC__JSGlobalObject__queueMicrotaskJob(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue JSValue2, JSC::EncodedJSValue JSValue3); +CPP_DECL void JSC__JSGlobalObject__reload(JSC::JSGlobalObject* arg0); +CPP_DECL JSC::VM* JSC__JSGlobalObject__vm(JSC::JSGlobalObject* arg0); #pragma mark - JSC::JSMap -CPP_DECL JSC__JSValue JSC__JSMap__create(JSC__JSGlobalObject* arg0); -CPP_DECL JSC__JSValue JSC__JSMap__get_(JSC__JSMap* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); -CPP_DECL bool JSC__JSMap__has(JSC__JSMap* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); -CPP_DECL bool JSC__JSMap__remove(JSC__JSMap* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); -CPP_DECL void JSC__JSMap__set(JSC__JSMap* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2, JSC__JSValue JSValue3); +CPP_DECL JSC::EncodedJSValue JSC__JSMap__create(JSC::JSGlobalObject* arg0); +CPP_DECL JSC::EncodedJSValue JSC__JSMap__get_(JSC::JSMap* arg0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); +CPP_DECL bool JSC__JSMap__has(JSC::JSMap* arg0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); +CPP_DECL bool JSC__JSMap__remove(JSC::JSMap* arg0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); +CPP_DECL void JSC__JSMap__set(JSC::JSMap* arg0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2, JSC::EncodedJSValue JSValue3); #pragma mark - JSC::JSValue -CPP_DECL void JSC__JSValue___then(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2, SYSV_ABI JSC__JSValue(* ArgFn3)(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1), SYSV_ABI JSC__JSValue(* ArgFn4)(JSC__JSGlobalObject* arg0, JSC__CallFrame* arg1)); -CPP_DECL bool JSC__JSValue__asArrayBuffer_(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, Bun__ArrayBuffer* arg2); -CPP_DECL unsigned char JSC__JSValue__asBigIntCompare(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); -CPP_DECL JSC__JSCell* JSC__JSValue__asCell(JSC__JSValue JSValue0); -CPP_DECL JSC__JSInternalPromise* JSC__JSValue__asInternalPromise(JSC__JSValue JSValue0); -CPP_DECL double JSC__JSValue__asNumber(JSC__JSValue JSValue0); -CPP_DECL bJSC__JSObject JSC__JSValue__asObject(JSC__JSValue JSValue0); -CPP_DECL JSC__JSPromise* JSC__JSValue__asPromise(JSC__JSValue JSValue0); -CPP_DECL JSC__JSString* JSC__JSValue__asString(JSC__JSValue JSValue0); -CPP_DECL double JSC__JSValue__coerceToDouble(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1); -CPP_DECL int32_t JSC__JSValue__coerceToInt32(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1); -CPP_DECL int64_t JSC__JSValue__coerceToInt64(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1); -CPP_DECL JSC__JSValue JSC__JSValue__createEmptyArray(JSC__JSGlobalObject* arg0, size_t arg1); -CPP_DECL JSC__JSValue JSC__JSValue__createEmptyObject(JSC__JSGlobalObject* arg0, size_t arg1); -CPP_DECL JSC__JSValue JSC__JSValue__createInternalPromise(JSC__JSGlobalObject* arg0); -CPP_DECL JSC__JSValue JSC__JSValue__createObject2(JSC__JSGlobalObject* arg0, const ZigString* arg1, const ZigString* arg2, JSC__JSValue JSValue3, JSC__JSValue JSValue4); -CPP_DECL JSC__JSValue JSC__JSValue__createRangeError(const ZigString* arg0, const ZigString* arg1, JSC__JSGlobalObject* arg2); -CPP_DECL JSC__JSValue JSC__JSValue__createRopeString(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* arg2); -CPP_DECL JSC__JSValue JSC__JSValue__createStringArray(JSC__JSGlobalObject* arg0, const ZigString* arg1, size_t arg2, bool arg3); -CPP_DECL JSC__JSValue JSC__JSValue__createTypeError(const ZigString* arg0, const ZigString* arg1, JSC__JSGlobalObject* arg2); -CPP_DECL JSC__JSValue JSC__JSValue__createUninitializedUint8Array(JSC__JSGlobalObject* arg0, size_t arg1); -CPP_DECL bool JSC__JSValue__deepEquals(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* arg2); -CPP_DECL bool JSC__JSValue__deepMatch(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* arg2, bool arg3); -CPP_DECL bool JSC__JSValue__eqlCell(JSC__JSValue JSValue0, JSC__JSCell* arg1); -CPP_DECL bool JSC__JSValue__eqlValue(JSC__JSValue JSValue0, JSC__JSValue JSValue1); -CPP_DECL JSC__JSValue JSC__JSValue__fastGet(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, unsigned char arg2); -CPP_DECL JSC__JSValue JSC__JSValue__fastGetDirect_(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, unsigned char arg2); -CPP_DECL void JSC__JSValue__forEach(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(JSC__VM* arg0, JSC__JSGlobalObject* arg1, void* arg2, JSC__JSValue JSValue3)); -CPP_DECL void JSC__JSValue__forEachProperty(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(JSC__JSGlobalObject* arg0, void* arg1, ZigString* arg2, JSC__JSValue JSValue3, bool arg4, bool arg5)); -CPP_DECL void JSC__JSValue__forEachPropertyOrdered(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(JSC__JSGlobalObject* arg0, void* arg1, ZigString* arg2, JSC__JSValue JSValue3, bool arg4, bool arg5)); -CPP_DECL JSC__JSValue JSC__JSValue__fromEntries(JSC__JSGlobalObject* arg0, ZigString* arg1, ZigString* arg2, size_t arg3, bool arg4); -CPP_DECL JSC__JSValue JSC__JSValue__fromInt64NoTruncate(JSC__JSGlobalObject* arg0, int64_t arg1); -CPP_DECL JSC__JSValue JSC__JSValue__fromUInt64NoTruncate(JSC__JSGlobalObject* arg0, uint64_t arg1); -CPP_DECL JSC__JSValue JSC__JSValue__fromTimevalNoTruncate(JSC__JSGlobalObject* arg0, int64_t nsec, int64_t sec); -CPP_DECL JSC__JSValue JSC__JSValue__bigIntSum(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue0, JSC__JSValue JSValue1); -CPP_DECL void JSC__JSValue__getClassName(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, ZigString* arg2); -CPP_DECL JSC__JSValue JSC__JSValue__getErrorsProperty(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1); -CPP_DECL JSC__JSValue JSC__JSValue__getIfPropertyExistsFromPath(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); -CPP_DECL JSC__JSValue JSC__JSValue__getIfPropertyExistsImpl(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, const unsigned char* arg2, uint32_t arg3); -CPP_DECL double JSC__JSValue__getLengthIfPropertyExistsInternal(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1); -CPP_DECL void JSC__JSValue__getNameProperty(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, ZigString* arg2); -CPP_DECL JSC__JSValue JSC__JSValue__getPrototype(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1); -CPP_DECL void JSC__JSValue__getSymbolDescription(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, ZigString* arg2); -CPP_DECL double JSC__JSValue__getUnixTimestamp(JSC__JSValue JSValue0); -CPP_DECL bool JSC__JSValue__hasOwnProperty(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, ZigString arg2); -CPP_DECL bool JSC__JSValue__isAggregateError(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1); -CPP_DECL bool JSC__JSValue__isAnyError(JSC__JSValue JSValue0); -CPP_DECL bool JSC__JSValue__isAnyInt(JSC__JSValue JSValue0); -CPP_DECL bool JSC__JSValue__isBigInt(JSC__JSValue JSValue0); -CPP_DECL bool JSC__JSValue__isBigInt32(JSC__JSValue JSValue0); -CPP_DECL bool JSC__JSValue__isCallable(JSC__JSValue JSValue0); -CPP_DECL bool JSC__JSValue__isClass(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1); -CPP_DECL bool JSC__JSValue__isConstructor(JSC__JSValue JSValue0); -CPP_DECL bool JSC__JSValue__isCustomGetterSetter(JSC__JSValue JSValue0); -CPP_DECL bool JSC__JSValue__isError(JSC__JSValue JSValue0); -CPP_DECL bool JSC__JSValue__isException(JSC__JSValue JSValue0, JSC__VM* arg1); -CPP_DECL bool JSC__JSValue__isGetterSetter(JSC__JSValue JSValue0); -CPP_DECL bool JSC__JSValue__isHeapBigInt(JSC__JSValue JSValue0); -CPP_DECL bool JSC__JSValue__isInstanceOf(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); -CPP_DECL bool JSC__JSValue__isInt32(JSC__JSValue JSValue0); -CPP_DECL bool JSC__JSValue__isInt32AsAnyInt(JSC__JSValue JSValue0); -CPP_DECL bool JSC__JSValue__isIterable(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1); -CPP_DECL bool JSC__JSValue__isNumber(JSC__JSValue JSValue0); -CPP_DECL bool JSC__JSValue__isObject(JSC__JSValue JSValue0); -CPP_DECL bool JSC__JSValue__isPrimitive(JSC__JSValue JSValue0); -CPP_DECL bool JSC__JSValue__isSameValue(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* arg2); -CPP_DECL bool JSC__JSValue__isSymbol(JSC__JSValue JSValue0); -CPP_DECL bool JSC__JSValue__isTerminationException(JSC__JSValue JSValue0, JSC__VM* arg1); -CPP_DECL bool JSC__JSValue__isUInt32AsAnyInt(JSC__JSValue JSValue0); -CPP_DECL bool JSC__JSValue__jestDeepEquals(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* arg2); -CPP_DECL bool JSC__JSValue__jestDeepMatch(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* arg2, bool arg3); -CPP_DECL bool JSC__JSValue__jestStrictDeepEquals(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* arg2); -CPP_DECL JSC__JSValue JSC__JSValue__jsBoolean(bool arg0); -CPP_DECL JSC__JSValue JSC__JSValue__jsDoubleNumber(double arg0); -CPP_DECL JSC__JSValue JSC__JSValue__jsNull(); -CPP_DECL JSC__JSValue JSC__JSValue__jsNumberFromChar(unsigned char arg0); -CPP_DECL JSC__JSValue JSC__JSValue__jsNumberFromDouble(double arg0); -CPP_DECL JSC__JSValue JSC__JSValue__jsNumberFromInt64(int64_t arg0); -CPP_DECL JSC__JSValue JSC__JSValue__jsNumberFromU16(uint16_t arg0); -CPP_DECL void JSC__JSValue__jsonStringify(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, uint32_t arg2, BunString* arg3); -CPP_DECL JSC__JSValue JSC__JSValue__jsTDZValue(); -CPP_DECL unsigned char JSC__JSValue__jsType(JSC__JSValue JSValue0); -CPP_DECL JSC__JSValue JSC__JSValue__jsUndefined(); -CPP_DECL JSC__JSValue JSC__JSValue__keys(JSC__JSGlobalObject* arg0, JSC__JSValue arg1); -CPP_DECL JSC__JSValue JSC__JSValue__values(JSC__JSGlobalObject* arg0, JSC__JSValue arg1); -CPP_DECL JSC__JSValue JSC__JSValue__parseJSON(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1); -CPP_DECL void JSC__JSValue__push(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); -CPP_DECL void JSC__JSValue__put(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, const ZigString* arg2, JSC__JSValue JSValue3); -CPP_DECL void JSC__JSValue__putIndex(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, uint32_t arg2, JSC__JSValue JSValue3); -CPP_DECL void JSC__JSValue__putRecord(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, ZigString* arg2, ZigString* arg3, size_t arg4); -CPP_DECL bool JSC__JSValue__strictDeepEquals(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* arg2); -CPP_DECL bool JSC__JSValue__stringIncludes(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); -CPP_DECL JSC__JSValue JSC__JSValue__symbolFor(JSC__JSGlobalObject* arg0, ZigString* arg1); -CPP_DECL bool JSC__JSValue__symbolKeyFor(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, ZigString* arg2); -CPP_DECL bool JSC__JSValue__toBoolean(JSC__JSValue JSValue0); -CPP_DECL JSC__JSValue JSC__JSValue__toError_(JSC__JSValue JSValue0); -CPP_DECL int32_t JSC__JSValue__toInt32(JSC__JSValue JSValue0); -CPP_DECL int64_t JSC__JSValue__toInt64(JSC__JSValue JSValue0); -CPP_DECL bool JSC__JSValue__toMatch(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); -CPP_DECL JSC__JSObject* JSC__JSValue__toObject(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1); -CPP_DECL JSC__JSString* JSC__JSValue__toString(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1); -CPP_DECL JSC__JSString* JSC__JSValue__toStringOrNull(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1); -CPP_DECL uint64_t JSC__JSValue__toUInt64NoTruncate(JSC__JSValue JSValue0); -CPP_DECL void JSC__JSValue__toZigException(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, ZigException* arg2); -CPP_DECL void JSC__JSValue__toZigString(JSC__JSValue JSValue0, ZigString* arg1, JSC__JSGlobalObject* arg2); - -#pragma mark - JSC::Exception - -CPP_DECL JSC__Exception* JSC__Exception__create(JSC__JSGlobalObject* arg0, JSC__JSObject* arg1, unsigned char StackCaptureAction2); -CPP_DECL JSC__JSValue JSC__Exception__value(JSC__Exception* arg0); +CPP_DECL void JSC__JSValue__then(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2, SYSV_ABI JSC::EncodedJSValue(* ArgFn3)(JSC::JSGlobalObject* arg0, JSC::CallFrame* arg1), SYSV_ABI JSC::EncodedJSValue(* ArgFn4)(JSC::JSGlobalObject* arg0, JSC::CallFrame* arg1)); +CPP_DECL bool JSC__JSValue__asArrayBuffer_(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, Bun__ArrayBuffer* arg2); +CPP_DECL unsigned char JSC__JSValue__asBigIntCompare(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); +CPP_DECL JSC::JSCell* JSC__JSValue__asCell(JSC::EncodedJSValue JSValue0); +CPP_DECL JSC::JSInternalPromise* JSC__JSValue__asInternalPromise(JSC::EncodedJSValue JSValue0); +CPP_DECL double JSC__JSValue__asNumber(JSC::EncodedJSValue JSValue0); +CPP_DECL JSC::JSPromise* JSC__JSValue__asPromise(JSC::EncodedJSValue JSValue0); +CPP_DECL JSC::JSString* JSC__JSValue__asString(JSC::EncodedJSValue JSValue0); +CPP_DECL double JSC__JSValue__coerceToDouble(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); +CPP_DECL int32_t JSC__JSValue__coerceToInt32(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); +CPP_DECL int64_t JSC__JSValue__coerceToInt64(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__createEmptyArray(JSC::JSGlobalObject* arg0, size_t arg1); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__createEmptyObject(JSC::JSGlobalObject* arg0, size_t arg1); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__createInternalPromise(JSC::JSGlobalObject* arg0); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__createObject2(JSC::JSGlobalObject* arg0, const ZigString* arg1, const ZigString* arg2, JSC::EncodedJSValue JSValue3, JSC::EncodedJSValue JSValue4); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__createRangeError(const ZigString* arg0, const ZigString* arg1, JSC::JSGlobalObject* arg2); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__createRopeString(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* arg2); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__createStringArray(JSC::JSGlobalObject* arg0, const ZigString* arg1, size_t arg2, bool arg3); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__createTypeError(const ZigString* arg0, const ZigString* arg1, JSC::JSGlobalObject* arg2); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__createUninitializedUint8Array(JSC::JSGlobalObject* arg0, size_t arg1); +CPP_DECL bool JSC__JSValue__deepEquals(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* arg2); +CPP_DECL bool JSC__JSValue__deepMatch(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* arg2, bool arg3); +CPP_DECL bool JSC__JSValue__eqlCell(JSC::EncodedJSValue JSValue0, JSC::JSCell* arg1); +CPP_DECL bool JSC__JSValue__eqlValue(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__fastGet(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, unsigned char arg2); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__fastGetDirect_(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, unsigned char arg2); +CPP_DECL void JSC__JSValue__forEach(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(JSC::VM* arg0, JSC::JSGlobalObject* arg1, void* arg2, JSC::EncodedJSValue JSValue3)); +CPP_DECL void JSC__JSValue__forEachProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(JSC::JSGlobalObject* arg0, void* arg1, ZigString* arg2, JSC::EncodedJSValue JSValue3, bool arg4, bool arg5)); +CPP_DECL void JSC__JSValue__forEachPropertyOrdered(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, void* arg2, void(* ArgFn3)(JSC::JSGlobalObject* arg0, void* arg1, ZigString* arg2, JSC::EncodedJSValue JSValue3, bool arg4, bool arg5)); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__fromEntries(JSC::JSGlobalObject* arg0, ZigString* arg1, ZigString* arg2, size_t arg3, bool arg4); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__fromInt64NoTruncate(JSC::JSGlobalObject* arg0, int64_t arg1); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__fromUInt64NoTruncate(JSC::JSGlobalObject* arg0, uint64_t arg1); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__fromTimevalNoTruncate(JSC::JSGlobalObject* arg0, int64_t nsec, int64_t sec); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__bigIntSum(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1); +CPP_DECL void JSC__JSValue__getClassName(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, ZigString* arg2); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__getErrorsProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__getIfPropertyExistsFromPath(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__getIfPropertyExistsImpl(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, const unsigned char* arg2, uint32_t arg3); +CPP_DECL double JSC__JSValue__getLengthIfPropertyExistsInternal(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); +CPP_DECL void JSC__JSValue__getNameProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, ZigString* arg2); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__getPrototype(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); +CPP_DECL void JSC__JSValue__getSymbolDescription(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, ZigString* arg2); +CPP_DECL double JSC__JSValue__getUnixTimestamp(JSC::EncodedJSValue JSValue0); +CPP_DECL bool JSC__JSValue__hasOwnProperty(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, ZigString arg2); +CPP_DECL bool JSC__JSValue__isAggregateError(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); +CPP_DECL bool JSC__JSValue__isAnyError(JSC::EncodedJSValue JSValue0); +CPP_DECL bool JSC__JSValue__isAnyInt(JSC::EncodedJSValue JSValue0); +CPP_DECL bool JSC__JSValue__isBigInt(JSC::EncodedJSValue JSValue0); +CPP_DECL bool JSC__JSValue__isBigInt32(JSC::EncodedJSValue JSValue0); +CPP_DECL bool JSC__JSValue__isCallable(JSC::EncodedJSValue JSValue0); +CPP_DECL bool JSC__JSValue__isClass(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); +CPP_DECL bool JSC__JSValue__isConstructor(JSC::EncodedJSValue JSValue0); +CPP_DECL bool JSC__JSValue__isCustomGetterSetter(JSC::EncodedJSValue JSValue0); +CPP_DECL bool JSC__JSValue__isError(JSC::EncodedJSValue JSValue0); +CPP_DECL bool JSC__JSValue__isException(JSC::EncodedJSValue JSValue0, JSC::VM* arg1); +CPP_DECL bool JSC__JSValue__isGetterSetter(JSC::EncodedJSValue JSValue0); +CPP_DECL bool JSC__JSValue__isHeapBigInt(JSC::EncodedJSValue JSValue0); +CPP_DECL bool JSC__JSValue__isInstanceOf(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); +CPP_DECL bool JSC__JSValue__isInt32(JSC::EncodedJSValue JSValue0); +CPP_DECL bool JSC__JSValue__isInt32AsAnyInt(JSC::EncodedJSValue JSValue0); +CPP_DECL bool JSC__JSValue__isIterable(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); +CPP_DECL bool JSC__JSValue__isNumber(JSC::EncodedJSValue JSValue0); +CPP_DECL bool JSC__JSValue__isObject(JSC::EncodedJSValue JSValue0); +CPP_DECL bool JSC__JSValue__isPrimitive(JSC::EncodedJSValue JSValue0); +CPP_DECL bool JSC__JSValue__isSameValue(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* arg2); +CPP_DECL bool JSC__JSValue__isSymbol(JSC::EncodedJSValue JSValue0); +CPP_DECL bool JSC__JSValue__isTerminationException(JSC::EncodedJSValue JSValue0, JSC::VM* arg1); +CPP_DECL bool JSC__JSValue__isUInt32AsAnyInt(JSC::EncodedJSValue JSValue0); +CPP_DECL bool JSC__JSValue__jestDeepEquals(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* arg2); +CPP_DECL bool JSC__JSValue__jestDeepMatch(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* arg2, bool arg3); +CPP_DECL bool JSC__JSValue__jestStrictDeepEquals(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* arg2); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__jsBoolean(bool arg0); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__jsDoubleNumber(double arg0); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__jsNull(); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__jsNumberFromChar(unsigned char arg0); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__jsNumberFromDouble(double arg0); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__jsNumberFromInt64(int64_t arg0); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__jsNumberFromU16(uint16_t arg0); +CPP_DECL void JSC__JSValue__jsonStringify(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, uint32_t arg2, BunString* arg3); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__jsTDZValue(); +CPP_DECL unsigned char JSC__JSValue__jsType(JSC::EncodedJSValue JSValue0); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__jsUndefined(); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__keys(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue arg1); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__values(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue arg1); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__parseJSON(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); +CPP_DECL void JSC__JSValue__push(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); +CPP_DECL void JSC__JSValue__put(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, const ZigString* arg2, JSC::EncodedJSValue JSValue3); +CPP_DECL void JSC__JSValue__putIndex(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, uint32_t arg2, JSC::EncodedJSValue JSValue3); +CPP_DECL void JSC__JSValue__putRecord(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, ZigString* arg2, ZigString* arg3, size_t arg4); +CPP_DECL bool JSC__JSValue__strictDeepEquals(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* arg2); +CPP_DECL bool JSC__JSValue__stringIncludes(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__symbolFor(JSC::JSGlobalObject* arg0, ZigString* arg1); +CPP_DECL bool JSC__JSValue__symbolKeyFor(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, ZigString* arg2); +CPP_DECL bool JSC__JSValue__toBoolean(JSC::EncodedJSValue JSValue0); +CPP_DECL JSC::EncodedJSValue JSC__JSValue__toError_(JSC::EncodedJSValue JSValue0); +CPP_DECL int32_t JSC__JSValue__toInt32(JSC::EncodedJSValue JSValue0); +CPP_DECL int64_t JSC__JSValue__toInt64(JSC::EncodedJSValue JSValue0); +CPP_DECL bool JSC__JSValue__toMatch(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); +CPP_DECL JSC::JSObject* JSC__JSValue__toObject(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); +CPP_DECL JSC::JSString* JSC__JSValue__toString(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); +CPP_DECL JSC::JSString* JSC__JSValue__toStringOrNull(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1); +CPP_DECL uint64_t JSC__JSValue__toUInt64NoTruncate(JSC::EncodedJSValue JSValue0); +CPP_DECL void JSC__JSValue__toZigException(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* arg1, ZigException* arg2); +CPP_DECL void JSC__JSValue__toZigString(JSC::EncodedJSValue JSValue0, ZigString* arg1, JSC::JSGlobalObject* arg2); #pragma mark - JSC::VM -CPP_DECL size_t JSC__VM__blockBytesAllocated(JSC__VM* arg0); -CPP_DECL void JSC__VM__clearExecutionTimeLimit(JSC__VM* arg0); -CPP_DECL void JSC__VM__collectAsync(JSC__VM* arg0); -CPP_DECL JSC__VM* JSC__VM__create(unsigned char HeapType0); -CPP_DECL void JSC__VM__deinit(JSC__VM* arg0, JSC__JSGlobalObject* arg1); -CPP_DECL void JSC__VM__deleteAllCode(JSC__VM* arg0, JSC__JSGlobalObject* arg1); -CPP_DECL void JSC__VM__drainMicrotasks(JSC__VM* arg0); -CPP_DECL bool JSC__VM__executionForbidden(JSC__VM* arg0); -CPP_DECL size_t JSC__VM__externalMemorySize(JSC__VM* arg0); -CPP_DECL size_t JSC__VM__heapSize(JSC__VM* arg0); -CPP_DECL void JSC__VM__holdAPILock(JSC__VM* arg0, void* arg1, void(* ArgFn2)(void* arg0)); -CPP_DECL bool JSC__VM__isEntered(JSC__VM* arg0); +CPP_DECL size_t JSC__VM__blockBytesAllocated(JSC::VM* arg0); +CPP_DECL void JSC__VM__clearExecutionTimeLimit(JSC::VM* arg0); +CPP_DECL void JSC__VM__collectAsync(JSC::VM* arg0); +CPP_DECL JSC::VM* JSC__VM__create(unsigned char HeapType0); +CPP_DECL void JSC__VM__deinit(JSC::VM* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL void JSC__VM__deleteAllCode(JSC::VM* arg0, JSC::JSGlobalObject* arg1); +CPP_DECL void JSC__VM__drainMicrotasks(JSC::VM* arg0); +CPP_DECL bool JSC__VM__executionForbidden(JSC::VM* arg0); +CPP_DECL size_t JSC__VM__externalMemorySize(JSC::VM* arg0); +CPP_DECL size_t JSC__VM__heapSize(JSC::VM* arg0); +CPP_DECL void JSC__VM__holdAPILock(JSC::VM* arg0, void* arg1, void(* ArgFn2)(void* arg0)); +CPP_DECL bool JSC__VM__isEntered(JSC::VM* arg0); CPP_DECL bool JSC__VM__isJITEnabled(); -CPP_DECL void JSC__VM__notifyNeedDebuggerBreak(JSC__VM* arg0); -CPP_DECL void JSC__VM__notifyNeedShellTimeoutCheck(JSC__VM* arg0); -CPP_DECL void JSC__VM__notifyNeedTermination(JSC__VM* arg0); -CPP_DECL void JSC__VM__notifyNeedWatchdogCheck(JSC__VM* arg0); -CPP_DECL void JSC__VM__releaseWeakRefs(JSC__VM* arg0); -CPP_DECL size_t JSC__VM__runGC(JSC__VM* arg0, bool arg1); -CPP_DECL void JSC__VM__setControlFlowProfiler(JSC__VM* arg0, bool arg1); -CPP_DECL void JSC__VM__setExecutionForbidden(JSC__VM* arg0, bool arg1); -CPP_DECL void JSC__VM__setExecutionTimeLimit(JSC__VM* arg0, double arg1); -CPP_DECL void JSC__VM__shrinkFootprint(JSC__VM* arg0); -CPP_DECL void JSC__VM__throwError(JSC__VM* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); -CPP_DECL void JSC__VM__throwError(JSC__VM* arg0, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2); -CPP_DECL void JSC__VM__whenIdle(JSC__VM* arg0, void(* ArgFn1)()); +CPP_DECL void JSC__VM__notifyNeedDebuggerBreak(JSC::VM* arg0); +CPP_DECL void JSC__VM__notifyNeedShellTimeoutCheck(JSC::VM* arg0); +CPP_DECL void JSC__VM__notifyNeedTermination(JSC::VM* arg0); +CPP_DECL void JSC__VM__notifyNeedWatchdogCheck(JSC::VM* arg0); +CPP_DECL void JSC__VM__releaseWeakRefs(JSC::VM* arg0); +CPP_DECL size_t JSC__VM__runGC(JSC::VM* arg0, bool arg1); +CPP_DECL void JSC__VM__setControlFlowProfiler(JSC::VM* arg0, bool arg1); +CPP_DECL void JSC__VM__setExecutionForbidden(JSC::VM* arg0, bool arg1); +CPP_DECL void JSC__VM__setExecutionTimeLimit(JSC::VM* arg0, double arg1); +CPP_DECL void JSC__VM__shrinkFootprint(JSC::VM* arg0); +CPP_DECL void JSC__VM__throwError(JSC::VM* arg0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); +CPP_DECL void JSC__VM__throwError(JSC::VM* arg0, JSC::JSGlobalObject* arg1, JSC::EncodedJSValue JSValue2); +CPP_DECL void JSC__VM__whenIdle(JSC::VM* arg0, void(* ArgFn1)()); #pragma mark - JSC::ThrowScope -CPP_DECL void JSC__ThrowScope__clearException(JSC__ThrowScope* arg0); -CPP_DECL bJSC__ThrowScope JSC__ThrowScope__declare(JSC__VM* arg0, unsigned char* arg1, unsigned char* arg2, size_t arg3); -CPP_DECL JSC__Exception* JSC__ThrowScope__exception(JSC__ThrowScope* arg0); -CPP_DECL void JSC__ThrowScope__release(JSC__ThrowScope* arg0); +CPP_DECL void JSC__ThrowScope__clearException(JSC::ThrowScope* arg0); +CPP_DECL JSC::Exception* JSC__ThrowScope__exception(JSC::ThrowScope* arg0); +CPP_DECL void JSC__ThrowScope__release(JSC::ThrowScope* arg0); #pragma mark - JSC::CatchScope -CPP_DECL void JSC__CatchScope__clearException(JSC__CatchScope* arg0); -CPP_DECL bJSC__CatchScope JSC__CatchScope__declare(JSC__VM* arg0, unsigned char* arg1, unsigned char* arg2, size_t arg3); -CPP_DECL JSC__Exception* JSC__CatchScope__exception(JSC__CatchScope* arg0); -CPP_DECL void FFI__ptr__put(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); +CPP_DECL void JSC__CatchScope__clearException(JSC::CatchScope* arg0); +CPP_DECL JSC::Exception* JSC__CatchScope__exception(JSC::CatchScope* arg0); +CPP_DECL void FFI__ptr__put(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); #ifdef __cplusplus -extern "C" JSC__JSValue SYSV_ABI FFI__ptr__fastpath(JSC__JSGlobalObject* arg0, void* arg1, Uint8Array_alias* arg2); -extern "C" JSC__JSValue SYSV_ABI FFI__ptr__slowpath(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue* arg2, size_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI FFI__ptr__fastpath(JSC::JSGlobalObject* arg0, void* arg1, JSC::JSUint8Array* arg2); +extern "C" JSC::EncodedJSValue SYSV_ABI FFI__ptr__slowpath(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue* arg2, size_t arg3); #endif -CPP_DECL void Reader__u8__put(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); +CPP_DECL void Reader__u8__put(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); #ifdef __cplusplus -extern "C" JSC__JSValue SYSV_ABI Reader__u8__fastpath(JSC__JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); -extern "C" JSC__JSValue SYSV_ABI Reader__u8__slowpath(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue* arg2, size_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__u8__fastpath(JSC::JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__u8__slowpath(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue* arg2, size_t arg3); #endif -CPP_DECL void Reader__u16__put(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); +CPP_DECL void Reader__u16__put(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); #ifdef __cplusplus -extern "C" JSC__JSValue SYSV_ABI Reader__u16__fastpath(JSC__JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); -extern "C" JSC__JSValue SYSV_ABI Reader__u16__slowpath(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue* arg2, size_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__u16__fastpath(JSC::JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__u16__slowpath(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue* arg2, size_t arg3); #endif -CPP_DECL void Reader__u32__put(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); +CPP_DECL void Reader__u32__put(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); #ifdef __cplusplus -extern "C" JSC__JSValue SYSV_ABI Reader__u32__fastpath(JSC__JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); -extern "C" JSC__JSValue SYSV_ABI Reader__u32__slowpath(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue* arg2, size_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__u32__fastpath(JSC::JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__u32__slowpath(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue* arg2, size_t arg3); #endif -CPP_DECL void Reader__ptr__put(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); +CPP_DECL void Reader__ptr__put(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); #ifdef __cplusplus -extern "C" JSC__JSValue SYSV_ABI Reader__ptr__fastpath(JSC__JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); -extern "C" JSC__JSValue SYSV_ABI Reader__ptr__slowpath(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue* arg2, size_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__ptr__fastpath(JSC::JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__ptr__slowpath(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue* arg2, size_t arg3); #endif -CPP_DECL void Reader__i8__put(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); +CPP_DECL void Reader__i8__put(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); #ifdef __cplusplus -extern "C" JSC__JSValue SYSV_ABI Reader__i8__fastpath(JSC__JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); -extern "C" JSC__JSValue SYSV_ABI Reader__i8__slowpath(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue* arg2, size_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__i8__fastpath(JSC::JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__i8__slowpath(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue* arg2, size_t arg3); #endif -CPP_DECL void Reader__i16__put(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); +CPP_DECL void Reader__i16__put(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); #ifdef __cplusplus -extern "C" JSC__JSValue SYSV_ABI Reader__i16__fastpath(JSC__JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); -extern "C" JSC__JSValue SYSV_ABI Reader__i16__slowpath(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue* arg2, size_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__i16__fastpath(JSC::JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__i16__slowpath(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue* arg2, size_t arg3); #endif -CPP_DECL void Reader__i32__put(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); +CPP_DECL void Reader__i32__put(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); #ifdef __cplusplus -extern "C" JSC__JSValue SYSV_ABI Reader__i32__fastpath(JSC__JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); -extern "C" JSC__JSValue SYSV_ABI Reader__i32__slowpath(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue* arg2, size_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__i32__fastpath(JSC::JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__i32__slowpath(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue* arg2, size_t arg3); #endif -CPP_DECL void Reader__f32__put(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); +CPP_DECL void Reader__f32__put(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); #ifdef __cplusplus -extern "C" JSC__JSValue SYSV_ABI Reader__f32__fastpath(JSC__JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); -extern "C" JSC__JSValue SYSV_ABI Reader__f32__slowpath(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue* arg2, size_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__f32__fastpath(JSC::JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__f32__slowpath(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue* arg2, size_t arg3); #endif -CPP_DECL void Reader__f64__put(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); +CPP_DECL void Reader__f64__put(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); #ifdef __cplusplus -extern "C" JSC__JSValue SYSV_ABI Reader__f64__fastpath(JSC__JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); -extern "C" JSC__JSValue SYSV_ABI Reader__f64__slowpath(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue* arg2, size_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__f64__fastpath(JSC::JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__f64__slowpath(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue* arg2, size_t arg3); #endif -CPP_DECL void Reader__i64__put(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); +CPP_DECL void Reader__i64__put(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); #ifdef __cplusplus -extern "C" JSC__JSValue SYSV_ABI Reader__i64__fastpath(JSC__JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); -extern "C" JSC__JSValue SYSV_ABI Reader__i64__slowpath(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue* arg2, size_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__i64__fastpath(JSC::JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__i64__slowpath(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue* arg2, size_t arg3); #endif -CPP_DECL void Reader__u64__put(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); +CPP_DECL void Reader__u64__put(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); #ifdef __cplusplus -extern "C" JSC__JSValue SYSV_ABI Reader__u64__fastpath(JSC__JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); -extern "C" JSC__JSValue SYSV_ABI Reader__u64__slowpath(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue* arg2, size_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__u64__fastpath(JSC::JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__u64__slowpath(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue* arg2, size_t arg3); #endif -CPP_DECL void Reader__intptr__put(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); +CPP_DECL void Reader__intptr__put(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); #ifdef __cplusplus -extern "C" JSC__JSValue SYSV_ABI Reader__intptr__fastpath(JSC__JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); -extern "C" JSC__JSValue SYSV_ABI Reader__intptr__slowpath(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue* arg2, size_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__intptr__fastpath(JSC::JSGlobalObject* arg0, void* arg1, int64_t arg2, int32_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Reader__intptr__slowpath(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue* arg2, size_t arg3); #endif #pragma mark - Zig::GlobalObject -CPP_DECL JSC__JSGlobalObject* Zig__GlobalObject__create(void* arg0, int32_t arg1, bool arg2, bool arg3, void* arg4); -CPP_DECL void* Zig__GlobalObject__getModuleRegistryMap(JSC__JSGlobalObject* arg0); -CPP_DECL bool Zig__GlobalObject__resetModuleRegistryMap(JSC__JSGlobalObject* arg0, void* arg1); +CPP_DECL JSC::JSGlobalObject* Zig__GlobalObject__create(void* arg0, int32_t arg1, bool arg2, bool arg3, void* arg4); +CPP_DECL void* Zig__GlobalObject__getModuleRegistryMap(JSC::JSGlobalObject* arg0); +CPP_DECL bool Zig__GlobalObject__resetModuleRegistryMap(JSC::JSGlobalObject* arg0, void* arg1); #ifdef __cplusplus -ZIG_DECL void Zig__GlobalObject__fetch(ErrorableResolvedSource* arg0, JSC__JSGlobalObject* arg1, BunString* arg2, BunString* arg3); +ZIG_DECL void Zig__GlobalObject__fetch(ErrorableResolvedSource* arg0, JSC::JSGlobalObject* arg1, BunString* arg2, BunString* arg3); ZIG_DECL void Zig__GlobalObject__onCrash(); -ZIG_DECL JSC__JSValue Zig__GlobalObject__promiseRejectionTracker(JSC__JSGlobalObject* arg0, JSC__JSPromise* arg1, uint32_t JSPromiseRejectionOperation2); -ZIG_DECL JSC__JSValue Zig__GlobalObject__reportUncaughtException(JSC__JSGlobalObject* arg0, JSC__Exception* arg1); -ZIG_DECL void Zig__GlobalObject__resolve(ErrorableString* arg0, JSC__JSGlobalObject* arg1, BunString* arg2, BunString* arg3, ZigString* arg4); +ZIG_DECL JSC::EncodedJSValue Zig__GlobalObject__promiseRejectionTracker(JSC::JSGlobalObject* arg0, JSC::JSPromise* arg1, uint32_t JSPromiseRejectionOperation2); +ZIG_DECL JSC::EncodedJSValue Zig__GlobalObject__reportUncaughtException(JSC::JSGlobalObject* arg0, JSC::Exception* arg1); +ZIG_DECL void Zig__GlobalObject__resolve(ErrorableString* arg0, JSC::JSGlobalObject* arg1, BunString* arg2, BunString* arg3, ZigString* arg4); #endif #ifdef __cplusplus -extern "C" JSC__JSValue SYSV_ABI Bun__Path__basename(JSC__JSGlobalObject* arg0, bool arg1, JSC__JSValue* arg2, uint16_t arg3); -extern "C" JSC__JSValue SYSV_ABI Bun__Path__dirname(JSC__JSGlobalObject* arg0, bool arg1, JSC__JSValue* arg2, uint16_t arg3); -extern "C" JSC__JSValue SYSV_ABI Bun__Path__extname(JSC__JSGlobalObject* arg0, bool arg1, JSC__JSValue* arg2, uint16_t arg3); -extern "C" JSC__JSValue SYSV_ABI Bun__Path__format(JSC__JSGlobalObject* arg0, bool arg1, JSC__JSValue* arg2, uint16_t arg3); -extern "C" JSC__JSValue SYSV_ABI Bun__Path__isAbsolute(JSC__JSGlobalObject* arg0, bool arg1, JSC__JSValue* arg2, uint16_t arg3); -extern "C" JSC__JSValue SYSV_ABI Bun__Path__join(JSC__JSGlobalObject* arg0, bool arg1, JSC__JSValue* arg2, uint16_t arg3); -extern "C" JSC__JSValue SYSV_ABI Bun__Path__normalize(JSC__JSGlobalObject* arg0, bool arg1, JSC__JSValue* arg2, uint16_t arg3); -extern "C" JSC__JSValue SYSV_ABI Bun__Path__parse(JSC__JSGlobalObject* arg0, bool arg1, JSC__JSValue* arg2, uint16_t arg3); -extern "C" JSC__JSValue SYSV_ABI Bun__Path__relative(JSC__JSGlobalObject* arg0, bool arg1, JSC__JSValue* arg2, uint16_t arg3); -extern "C" JSC__JSValue SYSV_ABI Bun__Path__resolve(JSC__JSGlobalObject* arg0, bool arg1, JSC__JSValue* arg2, uint16_t arg3); -extern "C" JSC__JSValue SYSV_ABI Bun__Path__toNamespacedPath(JSC__JSGlobalObject* arg0, bool arg1, JSC__JSValue* arg2, uint16_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Bun__Path__basename(JSC::JSGlobalObject* arg0, bool arg1, JSC::EncodedJSValue* arg2, uint16_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Bun__Path__dirname(JSC::JSGlobalObject* arg0, bool arg1, JSC::EncodedJSValue* arg2, uint16_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Bun__Path__extname(JSC::JSGlobalObject* arg0, bool arg1, JSC::EncodedJSValue* arg2, uint16_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Bun__Path__format(JSC::JSGlobalObject* arg0, bool arg1, JSC::EncodedJSValue* arg2, uint16_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Bun__Path__isAbsolute(JSC::JSGlobalObject* arg0, bool arg1, JSC::EncodedJSValue* arg2, uint16_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Bun__Path__join(JSC::JSGlobalObject* arg0, bool arg1, JSC::EncodedJSValue* arg2, uint16_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Bun__Path__normalize(JSC::JSGlobalObject* arg0, bool arg1, JSC::EncodedJSValue* arg2, uint16_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Bun__Path__parse(JSC::JSGlobalObject* arg0, bool arg1, JSC::EncodedJSValue* arg2, uint16_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Bun__Path__relative(JSC::JSGlobalObject* arg0, bool arg1, JSC::EncodedJSValue* arg2, uint16_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Bun__Path__resolve(JSC::JSGlobalObject* arg0, bool arg1, JSC::EncodedJSValue* arg2, uint16_t arg3); +extern "C" JSC::EncodedJSValue SYSV_ABI Bun__Path__toNamespacedPath(JSC::JSGlobalObject* arg0, bool arg1, JSC::EncodedJSValue* arg2, uint16_t arg3); #endif -CPP_DECL JSC__JSValue ArrayBufferSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, void* arg2, void** arg3); -CPP_DECL JSC__JSValue ArrayBufferSink__createObject(JSC__JSGlobalObject* arg0, void* arg1, uintptr_t destructor); -CPP_DECL void ArrayBufferSink__detachPtr(JSC__JSValue JSValue0); -CPP_DECL void ArrayBufferSink__onClose(JSC__JSValue JSValue0, JSC__JSValue JSValue1); -CPP_DECL void ArrayBufferSink__onReady(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSValue JSValue2); +CPP_DECL JSC::EncodedJSValue ArrayBufferSink__assignToStream(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, void* arg2, void** arg3); +CPP_DECL JSC::EncodedJSValue ArrayBufferSink__createObject(JSC::JSGlobalObject* arg0, void* arg1, uintptr_t destructor); +CPP_DECL void ArrayBufferSink__detachPtr(JSC::EncodedJSValue JSValue0); +CPP_DECL void ArrayBufferSink__onClose(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1); +CPP_DECL void ArrayBufferSink__onReady(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue JSValue2); #ifdef __cplusplus -ZIG_DECL JSC__JSValue ArrayBufferSink__close(JSC__JSGlobalObject* arg0, void* arg1); +ZIG_DECL JSC::EncodedJSValue ArrayBufferSink__close(JSC::JSGlobalObject* arg0, void* arg1); BUN_DECLARE_HOST_FUNCTION(ArrayBufferSink__construct); BUN_DECLARE_HOST_FUNCTION(ArrayBufferSink__end); -ZIG_DECL JSC__JSValue SYSV_ABI ArrayBufferSink__endWithSink(void* arg0, JSC__JSGlobalObject* arg1); +ZIG_DECL JSC::EncodedJSValue SYSV_ABI ArrayBufferSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); ZIG_DECL void ArrayBufferSink__finalize(void* arg0); BUN_DECLARE_HOST_FUNCTION(ArrayBufferSink__flush); BUN_DECLARE_HOST_FUNCTION(ArrayBufferSink__start); @@ -601,18 +492,18 @@ ZIG_DECL void ArrayBufferSink__updateRef(void* arg0, bool arg1); BUN_DECLARE_HOST_FUNCTION(ArrayBufferSink__write); #endif -CPP_DECL JSC__JSValue HTTPSResponseSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, void* arg2, void** arg3); -CPP_DECL JSC__JSValue HTTPSResponseSink__createObject(JSC__JSGlobalObject* arg0, void* arg1, uintptr_t destructor); -CPP_DECL void HTTPSResponseSink__detachPtr(JSC__JSValue JSValue0); -CPP_DECL void HTTPSResponseSink__onClose(JSC__JSValue JSValue0, JSC__JSValue JSValue1); -CPP_DECL void HTTPSResponseSink__onReady(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSValue JSValue2); +CPP_DECL JSC::EncodedJSValue HTTPSResponseSink__assignToStream(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, void* arg2, void** arg3); +CPP_DECL JSC::EncodedJSValue HTTPSResponseSink__createObject(JSC::JSGlobalObject* arg0, void* arg1, uintptr_t destructor); +CPP_DECL void HTTPSResponseSink__detachPtr(JSC::EncodedJSValue JSValue0); +CPP_DECL void HTTPSResponseSink__onClose(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1); +CPP_DECL void HTTPSResponseSink__onReady(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue JSValue2); #ifdef __cplusplus -ZIG_DECL JSC__JSValue HTTPSResponseSink__close(JSC__JSGlobalObject* arg0, void* arg1); +ZIG_DECL JSC::EncodedJSValue HTTPSResponseSink__close(JSC::JSGlobalObject* arg0, void* arg1); BUN_DECLARE_HOST_FUNCTION(HTTPSResponseSink__construct); BUN_DECLARE_HOST_FUNCTION(HTTPSResponseSink__end); -ZIG_DECL JSC__JSValue SYSV_ABI HTTPSResponseSink__endWithSink(void* arg0, JSC__JSGlobalObject* arg1); +ZIG_DECL JSC::EncodedJSValue SYSV_ABI HTTPSResponseSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); ZIG_DECL void HTTPSResponseSink__finalize(void* arg0); BUN_DECLARE_HOST_FUNCTION(HTTPSResponseSink__flush); BUN_DECLARE_HOST_FUNCTION(HTTPSResponseSink__start); @@ -620,18 +511,18 @@ ZIG_DECL void HTTPSResponseSink__updateRef(void* arg0, bool arg1); BUN_DECLARE_HOST_FUNCTION(HTTPSResponseSink__write); #endif -CPP_DECL JSC__JSValue HTTPResponseSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, void* arg2, void** arg3); -CPP_DECL JSC__JSValue HTTPResponseSink__createObject(JSC__JSGlobalObject* arg0, void* arg1, uintptr_t destructor); -CPP_DECL void HTTPResponseSink__detachPtr(JSC__JSValue JSValue0); -CPP_DECL void HTTPResponseSink__onClose(JSC__JSValue JSValue0, JSC__JSValue JSValue1); -CPP_DECL void HTTPResponseSink__onReady(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSValue JSValue2); +CPP_DECL JSC::EncodedJSValue HTTPResponseSink__assignToStream(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, void* arg2, void** arg3); +CPP_DECL JSC::EncodedJSValue HTTPResponseSink__createObject(JSC::JSGlobalObject* arg0, void* arg1, uintptr_t destructor); +CPP_DECL void HTTPResponseSink__detachPtr(JSC::EncodedJSValue JSValue0); +CPP_DECL void HTTPResponseSink__onClose(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1); +CPP_DECL void HTTPResponseSink__onReady(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue JSValue2); #ifdef __cplusplus -ZIG_DECL JSC__JSValue HTTPResponseSink__close(JSC__JSGlobalObject* arg0, void* arg1); +ZIG_DECL JSC::EncodedJSValue HTTPResponseSink__close(JSC::JSGlobalObject* arg0, void* arg1); BUN_DECLARE_HOST_FUNCTION(HTTPResponseSink__construct); BUN_DECLARE_HOST_FUNCTION(HTTPResponseSink__end); -ZIG_DECL JSC__JSValue SYSV_ABI SYSV_ABI HTTPResponseSink__endWithSink(void* arg0, JSC__JSGlobalObject* arg1); +ZIG_DECL JSC::EncodedJSValue SYSV_ABI SYSV_ABI HTTPResponseSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); ZIG_DECL void HTTPResponseSink__finalize(void* arg0); BUN_DECLARE_HOST_FUNCTION(HTTPResponseSink__flush); BUN_DECLARE_HOST_FUNCTION(HTTPResponseSink__start); @@ -639,18 +530,18 @@ ZIG_DECL void HTTPResponseSink__updateRef(void* arg0, bool arg1); BUN_DECLARE_HOST_FUNCTION(HTTPResponseSink__write); #endif -CPP_DECL JSC__JSValue FileSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, void* arg2, void** arg3); -CPP_DECL JSC__JSValue FileSink__createObject(JSC__JSGlobalObject* arg0, void* arg1, uintptr_t destructor); -CPP_DECL void FileSink__detachPtr(JSC__JSValue JSValue0); -CPP_DECL void FileSink__onClose(JSC__JSValue JSValue0, JSC__JSValue JSValue1); -CPP_DECL void FileSink__onReady(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSValue JSValue2); +CPP_DECL JSC::EncodedJSValue FileSink__assignToStream(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, void* arg2, void** arg3); +CPP_DECL JSC::EncodedJSValue FileSink__createObject(JSC::JSGlobalObject* arg0, void* arg1, uintptr_t destructor); +CPP_DECL void FileSink__detachPtr(JSC::EncodedJSValue JSValue0); +CPP_DECL void FileSink__onClose(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1); +CPP_DECL void FileSink__onReady(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue JSValue2); #ifdef __cplusplus -ZIG_DECL JSC__JSValue FileSink__close(JSC__JSGlobalObject* arg0, void* arg1); +ZIG_DECL JSC::EncodedJSValue FileSink__close(JSC::JSGlobalObject* arg0, void* arg1); BUN_DECLARE_HOST_FUNCTION(FileSink__construct); BUN_DECLARE_HOST_FUNCTION(FileSink__end); -ZIG_DECL JSC__JSValue SYSV_ABI FileSink__endWithSink(void* arg0, JSC__JSGlobalObject* arg1); +ZIG_DECL JSC::EncodedJSValue SYSV_ABI FileSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); ZIG_DECL void FileSink__finalize(void* arg0); BUN_DECLARE_HOST_FUNCTION(FileSink__flush); BUN_DECLARE_HOST_FUNCTION(FileSink__start); @@ -659,18 +550,18 @@ BUN_DECLARE_HOST_FUNCTION(FileSink__write); #endif -CPP_DECL JSC__JSValue FileSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, void* arg2, void** arg3); -CPP_DECL JSC__JSValue FileSink__createObject(JSC__JSGlobalObject* arg0, void* arg1, uintptr_t destructor); -CPP_DECL void FileSink__detachPtr(JSC__JSValue JSValue0); -CPP_DECL void FileSink__onClose(JSC__JSValue JSValue0, JSC__JSValue JSValue1); -CPP_DECL void FileSink__onReady(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSValue JSValue2); +CPP_DECL JSC::EncodedJSValue FileSink__assignToStream(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, void* arg2, void** arg3); +CPP_DECL JSC::EncodedJSValue FileSink__createObject(JSC::JSGlobalObject* arg0, void* arg1, uintptr_t destructor); +CPP_DECL void FileSink__detachPtr(JSC::EncodedJSValue JSValue0); +CPP_DECL void FileSink__onClose(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1); +CPP_DECL void FileSink__onReady(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue JSValue2); #ifdef __cplusplus -ZIG_DECL JSC__JSValue FileSink__close(JSC__JSGlobalObject* arg0, void* arg1); +ZIG_DECL JSC::EncodedJSValue FileSink__close(JSC::JSGlobalObject* arg0, void* arg1); BUN_DECLARE_HOST_FUNCTION(FileSink__construct); BUN_DECLARE_HOST_FUNCTION(FileSink__end); -ZIG_DECL JSC__JSValue SYSV_ABI FileSink__endWithSink(void* arg0, JSC__JSGlobalObject* arg1); +ZIG_DECL JSC::EncodedJSValue SYSV_ABI FileSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); ZIG_DECL void FileSink__finalize(void* arg0); BUN_DECLARE_HOST_FUNCTION(FileSink__flush); BUN_DECLARE_HOST_FUNCTION(FileSink__start); @@ -678,19 +569,19 @@ ZIG_DECL void FileSink__updateRef(void* arg0, bool arg1); BUN_DECLARE_HOST_FUNCTION(FileSink__write); #endif -CPP_DECL JSC__JSValue NetworkSink__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, void* arg2, void** arg3); -CPP_DECL JSC__JSValue NetworkSink__createObject(JSC__JSGlobalObject* arg0, void* arg1, uintptr_t destructor); -CPP_DECL void NetworkSink__detachPtr(JSC__JSValue JSValue0); -CPP_DECL void* NetworkSink__fromJS(JSC__JSValue JSValue1); -CPP_DECL void NetworkSink__onClose(JSC__JSValue JSValue0, JSC__JSValue JSValue1); -CPP_DECL void NetworkSink__onReady(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSValue JSValue2); +CPP_DECL JSC::EncodedJSValue NetworkSink__assignToStream(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, void* arg2, void** arg3); +CPP_DECL JSC::EncodedJSValue NetworkSink__createObject(JSC::JSGlobalObject* arg0, void* arg1, uintptr_t destructor); +CPP_DECL void NetworkSink__detachPtr(JSC::EncodedJSValue JSValue0); +CPP_DECL void* NetworkSink__fromJS(JSC::EncodedJSValue JSValue1); +CPP_DECL void NetworkSink__onClose(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1); +CPP_DECL void NetworkSink__onReady(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue JSValue2); #ifdef __cplusplus -ZIG_DECL JSC__JSValue NetworkSink__close(JSC__JSGlobalObject* arg0, void* arg1); +ZIG_DECL JSC::EncodedJSValue NetworkSink__close(JSC::JSGlobalObject* arg0, void* arg1); BUN_DECLARE_HOST_FUNCTION(NetworkSink__construct); BUN_DECLARE_HOST_FUNCTION(NetworkSink__end); -ZIG_DECL JSC__JSValue SYSV_ABI SYSV_ABI NetworkSink__endWithSink(void* arg0, JSC__JSGlobalObject* arg1); +ZIG_DECL JSC::EncodedJSValue SYSV_ABI SYSV_ABI NetworkSink__endWithSink(void* arg0, JSC::JSGlobalObject* arg1); ZIG_DECL void NetworkSink__finalize(void* arg0); BUN_DECLARE_HOST_FUNCTION(NetworkSink__flush); BUN_DECLARE_HOST_FUNCTION(NetworkSink__start); @@ -701,16 +592,16 @@ BUN_DECLARE_HOST_FUNCTION(NetworkSink__write); #ifdef __cplusplus ZIG_DECL void Bun__WebSocketHTTPClient__cancel(WebSocketHTTPClient* arg0); -ZIG_DECL WebSocketHTTPClient* Bun__WebSocketHTTPClient__connect(JSC__JSGlobalObject* arg0, void* arg1, CppWebSocket* arg2, const ZigString* arg3, uint16_t arg4, const ZigString* arg5, const ZigString* arg6, ZigString* arg7, ZigString* arg8, size_t arg9); -ZIG_DECL void Bun__WebSocketHTTPClient__register(JSC__JSGlobalObject* arg0, void* arg1, void* arg2); +ZIG_DECL WebSocketHTTPClient* Bun__WebSocketHTTPClient__connect(JSC::JSGlobalObject* arg0, void* arg1, CppWebSocket* arg2, const ZigString* arg3, uint16_t arg4, const ZigString* arg5, const ZigString* arg6, ZigString* arg7, ZigString* arg8, size_t arg9); +ZIG_DECL void Bun__WebSocketHTTPClient__register(JSC::JSGlobalObject* arg0, void* arg1, void* arg2); ZIG_DECL size_t Bun__WebSocketHTTPClient__memoryCost(WebSocketHTTPClient* arg0); #endif #ifdef __cplusplus ZIG_DECL void Bun__WebSocketHTTPSClient__cancel(WebSocketHTTPSClient* arg0); -ZIG_DECL WebSocketHTTPSClient* Bun__WebSocketHTTPSClient__connect(JSC__JSGlobalObject* arg0, void* arg1, CppWebSocket* arg2, const ZigString* arg3, uint16_t arg4, const ZigString* arg5, const ZigString* arg6, ZigString* arg7, ZigString* arg8, size_t arg9); -ZIG_DECL void Bun__WebSocketHTTPSClient__register(JSC__JSGlobalObject* arg0, void* arg1, void* arg2); +ZIG_DECL WebSocketHTTPSClient* Bun__WebSocketHTTPSClient__connect(JSC::JSGlobalObject* arg0, void* arg1, CppWebSocket* arg2, const ZigString* arg3, uint16_t arg4, const ZigString* arg5, const ZigString* arg6, ZigString* arg7, ZigString* arg8, size_t arg9); +ZIG_DECL void Bun__WebSocketHTTPSClient__register(JSC::JSGlobalObject* arg0, void* arg1, void* arg2); ZIG_DECL size_t Bun__WebSocketHTTPSClient__memoryCost(WebSocketHTTPSClient* arg0); #endif @@ -719,8 +610,8 @@ ZIG_DECL size_t Bun__WebSocketHTTPSClient__memoryCost(WebSocketHTTPSClient* arg0 ZIG_DECL void Bun__WebSocketClient__cancel(WebSocketClient* arg0); ZIG_DECL void Bun__WebSocketClient__close(WebSocketClient* arg0, uint16_t arg1, const ZigString* arg2); ZIG_DECL void Bun__WebSocketClient__finalize(WebSocketClient* arg0); -ZIG_DECL void* Bun__WebSocketClient__init(CppWebSocket* arg0, void* arg1, void* arg2, JSC__JSGlobalObject* arg3, unsigned char* arg4, size_t arg5); -ZIG_DECL void Bun__WebSocketClient__register(JSC__JSGlobalObject* arg0, void* arg1, void* arg2); +ZIG_DECL void* Bun__WebSocketClient__init(CppWebSocket* arg0, void* arg1, void* arg2, JSC::JSGlobalObject* arg3, unsigned char* arg4, size_t arg5); +ZIG_DECL void Bun__WebSocketClient__register(JSC::JSGlobalObject* arg0, void* arg1, void* arg2); ZIG_DECL void Bun__WebSocketClient__writeBinaryData(WebSocketClient* arg0, const unsigned char* arg1, size_t arg2, unsigned char arg3); ZIG_DECL void Bun__WebSocketClient__writeString(WebSocketClient* arg0, const ZigString* arg1, unsigned char arg2); ZIG_DECL size_t Bun__WebSocketClient__memoryCost(WebSocketClient* arg0); @@ -732,8 +623,8 @@ ZIG_DECL size_t Bun__WebSocketClient__memoryCost(WebSocketClient* arg0); ZIG_DECL void Bun__WebSocketClientTLS__cancel(WebSocketClientTLS* arg0); ZIG_DECL void Bun__WebSocketClientTLS__close(WebSocketClientTLS* arg0, uint16_t arg1, const ZigString* arg2); ZIG_DECL void Bun__WebSocketClientTLS__finalize(WebSocketClientTLS* arg0); -ZIG_DECL void* Bun__WebSocketClientTLS__init(CppWebSocket* arg0, void* arg1, void* arg2, JSC__JSGlobalObject* arg3, unsigned char* arg4, size_t arg5); -ZIG_DECL void Bun__WebSocketClientTLS__register(JSC__JSGlobalObject* arg0, void* arg1, void* arg2); +ZIG_DECL void* Bun__WebSocketClientTLS__init(CppWebSocket* arg0, void* arg1, void* arg2, JSC::JSGlobalObject* arg3, unsigned char* arg4, size_t arg5); +ZIG_DECL void Bun__WebSocketClientTLS__register(JSC::JSGlobalObject* arg0, void* arg1, void* arg2); ZIG_DECL void Bun__WebSocketClientTLS__writeBinaryData(WebSocketClientTLS* arg0, const unsigned char* arg1, size_t arg2, unsigned char arg3); ZIG_DECL void Bun__WebSocketClientTLS__writeString(WebSocketClientTLS* arg0, const ZigString* arg1, unsigned char arg2); ZIG_DECL size_t Bun__WebSocketClientTLS__memoryCost(WebSocketClientTLS* arg0); @@ -741,37 +632,37 @@ ZIG_DECL size_t Bun__WebSocketClientTLS__memoryCost(WebSocketClientTLS* arg0); #ifdef __cplusplus -ZIG_DECL /*[[noreturn]]*/ void Bun__Process__exit(JSC__JSGlobalObject* arg0, uint8_t arg1); // TODO(@190n) figure out why with a real [[noreturn]] annotation this trips ASan before calling the function -ZIG_DECL JSC__JSValue Bun__Process__createArgv(JSC__JSGlobalObject* arg0); -ZIG_DECL JSC__JSValue Bun__Process__createArgv0(JSC__JSGlobalObject* arg0); -ZIG_DECL JSC__JSValue Bun__Process__getCwd(JSC__JSGlobalObject* arg0); -ZIG_DECL JSC__JSValue Bun__Process__createExecArgv(JSC__JSGlobalObject* arg0); -ZIG_DECL JSC__JSValue Bun__Process__getExecPath(JSC__JSGlobalObject* arg0); -ZIG_DECL void Bun__Process__getTitle(JSC__JSGlobalObject* arg0, ZigString* arg1); -ZIG_DECL JSC__JSValue Bun__Process__setCwd(JSC__JSGlobalObject* arg0, ZigString* arg1); -ZIG_DECL JSC__JSValue Bun__Process__setTitle(JSC__JSGlobalObject* arg0, ZigString* arg1); +ZIG_DECL /*[[noreturn]]*/ void Bun__Process__exit(JSC::JSGlobalObject* arg0, uint8_t arg1); // TODO(@190n) figure out why with a real [[noreturn]] annotation this trips ASan before calling the function +ZIG_DECL JSC::EncodedJSValue Bun__Process__createArgv(JSC::JSGlobalObject* arg0); +ZIG_DECL JSC::EncodedJSValue Bun__Process__createArgv0(JSC::JSGlobalObject* arg0); +ZIG_DECL JSC::EncodedJSValue Bun__Process__getCwd(JSC::JSGlobalObject* arg0); +ZIG_DECL JSC::EncodedJSValue Bun__Process__createExecArgv(JSC::JSGlobalObject* arg0); +ZIG_DECL JSC::EncodedJSValue Bun__Process__getExecPath(JSC::JSGlobalObject* arg0); +ZIG_DECL void Bun__Process__getTitle(JSC::JSGlobalObject* arg0, ZigString* arg1); +ZIG_DECL JSC::EncodedJSValue Bun__Process__setCwd(JSC::JSGlobalObject* arg0, ZigString* arg1); +ZIG_DECL JSC::EncodedJSValue Bun__Process__setTitle(JSC::JSGlobalObject* arg0, ZigString* arg1); #endif -CPP_DECL ZigException ZigException__fromException(JSC__Exception* arg0); +CPP_DECL ZigException ZigException__fromException(JSC::Exception* arg0); #pragma mark - Bun::ConsoleObject #ifdef __cplusplus -extern "C" SYSV_ABI void Bun__ConsoleObject__count(void* arg0, JSC__JSGlobalObject* arg1, const unsigned char* arg2, size_t arg3); -extern "C" SYSV_ABI void Bun__ConsoleObject__countReset(void* arg0, JSC__JSGlobalObject* arg1, const unsigned char* arg2, size_t arg3); -extern "C" SYSV_ABI void Bun__ConsoleObject__messageWithTypeAndLevel(void* arg0, uint32_t MessageType1, uint32_t MessageLevel2, JSC__JSGlobalObject* arg3, JSC__JSValue* arg4, size_t arg5); -extern "C" SYSV_ABI void Bun__ConsoleObject__profile(void* arg0, JSC__JSGlobalObject* arg1, const unsigned char* arg2, size_t arg3); -extern "C" SYSV_ABI void Bun__ConsoleObject__profileEnd(void* arg0, JSC__JSGlobalObject* arg1, const unsigned char* arg2, size_t arg3); -extern "C" SYSV_ABI void Bun__ConsoleObject__record(void* arg0, JSC__JSGlobalObject* arg1, ScriptArguments* arg2); -extern "C" SYSV_ABI void Bun__ConsoleObject__recordEnd(void* arg0, JSC__JSGlobalObject* arg1, ScriptArguments* arg2); -extern "C" SYSV_ABI void Bun__ConsoleObject__screenshot(void* arg0, JSC__JSGlobalObject* arg1, ScriptArguments* arg2); -extern "C" SYSV_ABI void Bun__ConsoleObject__takeHeapSnapshot(void* arg0, JSC__JSGlobalObject* arg1, const unsigned char* arg2, size_t arg3); -extern "C" SYSV_ABI void Bun__ConsoleObject__time(void* arg0, JSC__JSGlobalObject* arg1, const unsigned char* arg2, size_t arg3); -extern "C" SYSV_ABI void Bun__ConsoleObject__timeEnd(void* arg0, JSC__JSGlobalObject* arg1, const unsigned char* arg2, size_t arg3); -extern "C" SYSV_ABI void Bun__ConsoleObject__timeLog(void* arg0, JSC__JSGlobalObject* arg1, const unsigned char* arg2, size_t arg3, JSC__JSValue* arg4, size_t arg5); -extern "C" SYSV_ABI void Bun__ConsoleObject__timeStamp(void* arg0, JSC__JSGlobalObject* arg1, ScriptArguments* arg2); +extern "C" SYSV_ABI void Bun__ConsoleObject__count(void* arg0, JSC::JSGlobalObject* arg1, const unsigned char* arg2, size_t arg3); +extern "C" SYSV_ABI void Bun__ConsoleObject__countReset(void* arg0, JSC::JSGlobalObject* arg1, const unsigned char* arg2, size_t arg3); +extern "C" SYSV_ABI void Bun__ConsoleObject__messageWithTypeAndLevel(void* arg0, uint32_t MessageType1, uint32_t MessageLevel2, JSC::JSGlobalObject* arg3, JSC::EncodedJSValue* arg4, size_t arg5); +extern "C" SYSV_ABI void Bun__ConsoleObject__profile(void* arg0, JSC::JSGlobalObject* arg1, const unsigned char* arg2, size_t arg3); +extern "C" SYSV_ABI void Bun__ConsoleObject__profileEnd(void* arg0, JSC::JSGlobalObject* arg1, const unsigned char* arg2, size_t arg3); +extern "C" SYSV_ABI void Bun__ConsoleObject__record(void* arg0, JSC::JSGlobalObject* arg1, ScriptArguments* arg2); +extern "C" SYSV_ABI void Bun__ConsoleObject__recordEnd(void* arg0, JSC::JSGlobalObject* arg1, ScriptArguments* arg2); +extern "C" SYSV_ABI void Bun__ConsoleObject__screenshot(void* arg0, JSC::JSGlobalObject* arg1, ScriptArguments* arg2); +extern "C" SYSV_ABI void Bun__ConsoleObject__takeHeapSnapshot(void* arg0, JSC::JSGlobalObject* arg1, const unsigned char* arg2, size_t arg3); +extern "C" SYSV_ABI void Bun__ConsoleObject__time(void* arg0, JSC::JSGlobalObject* arg1, const unsigned char* arg2, size_t arg3); +extern "C" SYSV_ABI void Bun__ConsoleObject__timeEnd(void* arg0, JSC::JSGlobalObject* arg1, const unsigned char* arg2, size_t arg3); +extern "C" SYSV_ABI void Bun__ConsoleObject__timeLog(void* arg0, JSC::JSGlobalObject* arg1, const unsigned char* arg2, size_t arg3, JSC::EncodedJSValue* arg4, size_t arg5); +extern "C" SYSV_ABI void Bun__ConsoleObject__timeStamp(void* arg0, JSC::JSGlobalObject* arg1, ScriptArguments* arg2); #endif @@ -780,11 +671,11 @@ extern "C" SYSV_ABI void Bun__ConsoleObject__timeStamp(void* arg0, JSC__JSGlobal #ifdef __cplusplus -ZIG_DECL JSC__JSValue Bun__Timer__clearImmediate(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); -ZIG_DECL JSC__JSValue Bun__Timer__clearInterval(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); -ZIG_DECL JSC__JSValue Bun__Timer__clearTimeout(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1); +ZIG_DECL JSC::EncodedJSValue Bun__Timer__clearImmediate(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); +ZIG_DECL JSC::EncodedJSValue Bun__Timer__clearInterval(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); +ZIG_DECL JSC::EncodedJSValue Bun__Timer__clearTimeout(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1); ZIG_DECL int32_t Bun__Timer__getNextID(); -ZIG_DECL JSC__JSValue Bun__Timer__setInterval(JSC__JSGlobalObject* globalThis, JSC__JSValue callback, JSC__JSValue countdown, JSC__JSValue arguments); +ZIG_DECL JSC::EncodedJSValue Bun__Timer__setInterval(JSC::JSGlobalObject* globalThis, JSC::EncodedJSValue callback, JSC::EncodedJSValue countdown, JSC::EncodedJSValue arguments); namespace Bun { enum class CountdownOverflowBehavior : uint8_t { // If the countdown overflows the range of int32_t, use a countdown of 1ms instead. Behavior of `setTimeout` and friends. @@ -793,7 +684,8 @@ enum class CountdownOverflowBehavior : uint8_t { Clamp, }; } // namespace Bun -ZIG_DECL JSC__JSValue Bun__Timer__setTimeout(JSC__JSGlobalObject* globalThis, JSC__JSValue callback, JSC__JSValue countdown, JSC__JSValue arguments, Bun::CountdownOverflowBehavior behavior); +ZIG_DECL JSC::EncodedJSValue Bun__Timer__setTimeout(JSC::JSGlobalObject* globalThis, JSC::EncodedJSValue callback, JSC::EncodedJSValue countdown, JSC::EncodedJSValue arguments, Bun::CountdownOverflowBehavior behavior); +ZIG_DECL JSC::EncodedJSValue Bun__Timer__setImmediate(JSC::JSGlobalObject* globalThis, JSC::EncodedJSValue callback, JSC::EncodedJSValue arguments); #endif @@ -862,11 +754,11 @@ BUN_DECLARE_HOST_FUNCTION(Bun__TestScope__onResolve); #ifdef __cplusplus -CPP_DECL bool JSC__GetterSetter__isGetterNull(JSC__GetterSetter *arg); -CPP_DECL bool JSC__GetterSetter__isSetterNull(JSC__GetterSetter *arg); +CPP_DECL bool JSC__GetterSetter__isGetterNull(JSC::GetterSetter *arg); +CPP_DECL bool JSC__GetterSetter__isSetterNull(JSC::GetterSetter *arg); -CPP_DECL bool JSC__CustomGetterSetter__isGetterNull(JSC__CustomGetterSetter *arg); -CPP_DECL bool JSC__CustomGetterSetter__isSetterNull(JSC__CustomGetterSetter *arg); +CPP_DECL bool JSC__CustomGetterSetter__isGetterNull(JSC::CustomGetterSetter *arg); +CPP_DECL bool JSC__CustomGetterSetter__isSetterNull(JSC::CustomGetterSetter *arg); #endif diff --git a/src/bun.js/bindings/helpers.h b/src/bun.js/bindings/helpers.h index 13962fd336..0d1ee0ed6e 100644 --- a/src/bun.js/bindings/helpers.h +++ b/src/bun.js/bindings/helpers.h @@ -12,10 +12,6 @@ #include #include -using JSC__JSGlobalObject = JSC::JSGlobalObject; -using JSC__JSValue = JSC::EncodedJSValue; -using JSC__CallFrame = JSC::CallFrame; - namespace Zig { class GlobalObject; } @@ -319,7 +315,7 @@ static const WTF::String toStringStatic(ZigString str) return WTF::String(ascii); } -static JSC::JSValue getErrorInstance(const ZigString* str, JSC__JSGlobalObject* globalObject) +static JSC::JSValue getErrorInstance(const ZigString* str, JSC::JSGlobalObject* globalObject) { WTF::String message = toString(*str); if (UNLIKELY(message.isNull() && str->len > 0)) { @@ -333,7 +329,7 @@ static JSC::JSValue getErrorInstance(const ZigString* str, JSC__JSGlobalObject* return JSC::JSValue(result); } -static JSC::JSValue getTypeErrorInstance(const ZigString* str, JSC__JSGlobalObject* globalObject) +static JSC::JSValue getTypeErrorInstance(const ZigString* str, JSC::JSGlobalObject* globalObject) { JSC::JSObject* result = JSC::createTypeError(globalObject, toStringCopy(*str)); JSC::EnsureStillAliveScope ensureAlive(result); @@ -341,7 +337,7 @@ static JSC::JSValue getTypeErrorInstance(const ZigString* str, JSC__JSGlobalObje return JSC::JSValue(result); } -static JSC::JSValue getSyntaxErrorInstance(const ZigString* str, JSC__JSGlobalObject* globalObject) +static JSC::JSValue getSyntaxErrorInstance(const ZigString* str, JSC::JSGlobalObject* globalObject) { JSC::JSObject* result = JSC::createSyntaxError(globalObject, toStringCopy(*str)); JSC::EnsureStillAliveScope ensureAlive(result); @@ -349,7 +345,7 @@ static JSC::JSValue getSyntaxErrorInstance(const ZigString* str, JSC__JSGlobalOb return JSC::JSValue(result); } -static JSC::JSValue getRangeErrorInstance(const ZigString* str, JSC__JSGlobalObject* globalObject) +static JSC::JSValue getRangeErrorInstance(const ZigString* str, JSC::JSGlobalObject* globalObject) { JSC::JSObject* result = JSC::createRangeError(globalObject, toStringCopy(*str)); JSC::EnsureStillAliveScope ensureAlive(result); @@ -383,7 +379,7 @@ static void throwSystemError(JSC::ThrowScope& scope, JSC::JSGlobalObject* global } template -OutType* WebCoreCast(JSC__JSValue JSValue0) +OutType* WebCoreCast(JSC::EncodedJSValue JSValue0) { // we must use jsDynamicCast here so that we check that the type is correct WebCoreType* jsdomURL = JSC::jsDynamicCast(JSC::JSValue::decode(JSValue0)); diff --git a/src/bun.js/bindings/napi.cpp b/src/bun.js/bindings/napi.cpp index 949880cc9e..da229db8c9 100644 --- a/src/bun.js/bindings/napi.cpp +++ b/src/bun.js/bindings/napi.cpp @@ -1198,7 +1198,7 @@ extern "C" napi_status napi_create_reference(napi_env env, napi_value value, NAPI_RETURN_SUCCESS(env); } -extern "C" void napi_set_ref(NapiRef* ref, JSC__JSValue val_) +extern "C" void napi_set_ref(NapiRef* ref, JSC::EncodedJSValue val_) { NAPI_LOG_CURRENT_FUNCTION; JSC::JSValue val = JSC::JSValue::decode(val_); diff --git a/src/bun.js/bindings/node/NodeTimers.cpp b/src/bun.js/bindings/node/NodeTimers.cpp new file mode 100644 index 0000000000..a2b62431f2 --- /dev/null +++ b/src/bun.js/bindings/node/NodeTimers.cpp @@ -0,0 +1,233 @@ +#include "NodeTimers.h" + +#include "ErrorCode.h" +#include "headers.h" + +namespace Bun { + +using namespace JSC; + +JSC_DEFINE_HOST_FUNCTION(functionSetTimeout, + (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) +{ + auto& vm = JSC::getVM(globalObject); + JSC::JSValue job = callFrame->argument(0); + JSC::JSValue num = callFrame->argument(1); + JSC::JSValue arguments = {}; + size_t argumentCount = callFrame->argumentCount(); + auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); + switch (argumentCount) { + case 0: { + Bun::throwError(globalObject, scope, ErrorCode::ERR_INVALID_ARG_TYPE, "setTimeout requires 1 argument (a function)"_s); + return {}; + } + case 1: + case 2: { + break; + } + case 3: { + arguments = callFrame->argument(2); + break; + } + + default: { + ArgList argumentsList = ArgList(callFrame, 2); + auto* args = JSC::JSImmutableButterfly::tryCreateFromArgList(vm, argumentsList); + + if (UNLIKELY(!args)) { + JSC::throwOutOfMemoryError(globalObject, scope); + return {}; + } + + arguments = JSValue(args); + } + } + + if (UNLIKELY(!job.isObject() || !job.getObject()->isCallable())) { + Bun::throwError(globalObject, scope, ErrorCode::ERR_INVALID_ARG_TYPE, "setTimeout expects a function"_s); + return {}; + } + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return Bun__Timer__setTimeout(globalObject, JSC::JSValue::encode(job), JSC::JSValue::encode(num), JSValue::encode(arguments), Bun::CountdownOverflowBehavior::OneMs); +} + +JSC_DEFINE_HOST_FUNCTION(functionSetInterval, + (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) +{ + auto& vm = JSC::getVM(globalObject); + JSC::JSValue job = callFrame->argument(0); + JSC::JSValue num = callFrame->argument(1); + JSC::JSValue arguments = {}; + size_t argumentCount = callFrame->argumentCount(); + auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); + + switch (argumentCount) { + case 0: { + Bun::throwError(globalObject, scope, ErrorCode::ERR_INVALID_ARG_TYPE, "setInterval requires 1 argument (a function)"_s); + return {}; + } + case 1: { + num = jsNumber(0); + break; + } + case 2: { + break; + } + case 3: { + arguments = callFrame->argument(2); + break; + } + + default: { + ArgList argumentsList = ArgList(callFrame, 2); + auto* args = JSC::JSImmutableButterfly::tryCreateFromArgList(vm, argumentsList); + + if (UNLIKELY(!args)) { + JSC::throwOutOfMemoryError(globalObject, scope); + return {}; + } + + arguments = JSValue(args); + } + } + + if (UNLIKELY(!job.isObject() || !job.getObject()->isCallable())) { + Bun::throwError(globalObject, scope, ErrorCode::ERR_INVALID_ARG_TYPE, "setInterval expects a function"_s); + return {}; + } + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return Bun__Timer__setInterval(globalObject, JSC::JSValue::encode(job), JSC::JSValue::encode(num), JSValue::encode(arguments)); +} + +// https://developer.mozilla.org/en-US/docs/Web/API/Window/setImmediate +JSC_DEFINE_HOST_FUNCTION(functionSetImmediate, + (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) +{ + auto& vm = JSC::getVM(globalObject); + auto scope = DECLARE_THROW_SCOPE(vm); + + auto argCount = callFrame->argumentCount(); + if (argCount == 0) { + Bun::throwError(globalObject, scope, ErrorCode::ERR_INVALID_ARG_TYPE, "setImmediate requires 1 argument (a function)"_s); + return {}; + } + + auto job = callFrame->argument(0); + + if (!job.isObject() || !job.getObject()->isCallable()) { + Bun::throwError(globalObject, scope, ErrorCode::ERR_INVALID_ARG_TYPE, "setImmediate expects a function"_s); + return {}; + } + + JSC::JSValue arguments = {}; + switch (argCount) { + case 0: + case 1: { + break; + } + case 2: { + arguments = callFrame->argument(1); + break; + } + default: { + ArgList argumentsList = ArgList(callFrame, 1); + auto* args = JSC::JSImmutableButterfly::tryCreateFromArgList(vm, argumentsList); + + if (UNLIKELY(!args)) { + JSC::throwOutOfMemoryError(globalObject, scope); + return {}; + } + + arguments = JSValue(args); + } + } + + return Bun__Timer__setImmediate(globalObject, JSC::JSValue::encode(job), JSValue::encode(arguments)); +} + +JSC_DEFINE_HOST_FUNCTION(functionClearImmediate, + (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) +{ + auto& vm = JSC::getVM(globalObject); + + JSC::JSValue timer_or_num = callFrame->argument(0); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return Bun__Timer__clearImmediate(globalObject, JSC::JSValue::encode(timer_or_num)); +} + +JSC_DEFINE_HOST_FUNCTION(functionClearInterval, + (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) +{ + auto& vm = JSC::getVM(globalObject); + + JSC::JSValue timer_or_num = callFrame->argument(0); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return Bun__Timer__clearInterval(globalObject, JSC::JSValue::encode(timer_or_num)); +} + +JSC_DEFINE_HOST_FUNCTION(functionClearTimeout, + (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) +{ + auto& vm = JSC::getVM(globalObject); + + JSC::JSValue timer_or_num = callFrame->argument(0); + +#ifdef BUN_DEBUG + /** View the file name of the JS file that called this function + * from a debugger */ + SourceOrigin sourceOrigin = callFrame->callerSourceOrigin(vm); + const char* fileName = sourceOrigin.string().utf8().data(); + static const char* lastFileName = nullptr; + if (lastFileName != fileName) { + lastFileName = fileName; + } +#endif + + return Bun__Timer__clearTimeout(globalObject, JSC::JSValue::encode(timer_or_num)); +} + +} // namespace Bun diff --git a/src/bun.js/bindings/node/NodeTimers.h b/src/bun.js/bindings/node/NodeTimers.h new file mode 100644 index 0000000000..eafe504d16 --- /dev/null +++ b/src/bun.js/bindings/node/NodeTimers.h @@ -0,0 +1,14 @@ +#pragma once + +#include "root.h" + +namespace Bun { + +JSC_DECLARE_HOST_FUNCTION(functionSetTimeout); +JSC_DECLARE_HOST_FUNCTION(functionSetInterval); +JSC_DECLARE_HOST_FUNCTION(functionSetImmediate); +JSC_DECLARE_HOST_FUNCTION(functionClearTimeout); +JSC_DECLARE_HOST_FUNCTION(functionClearInterval); +JSC_DECLARE_HOST_FUNCTION(functionClearImmediate); + +} // namespace Bun diff --git a/src/bun.js/jsc/host_fn.zig b/src/bun.js/jsc/host_fn.zig index bda2ea846b..bf78643df1 100644 --- a/src/bun.js/jsc/host_fn.zig +++ b/src/bun.js/jsc/host_fn.zig @@ -16,31 +16,12 @@ pub fn JSHostFunctionTypeWithContext(comptime ContextType: type) type { pub fn toJSHostFn(comptime functionToWrap: JSHostFnZig) JSHostFn { return struct { pub fn function(globalThis: *JSGlobalObject, callframe: *CallFrame) callconv(jsc.conv) JSValue { - if (bun.Environment.allow_assert and bun.Environment.is_canary) { + if (Environment.allow_assert and Environment.is_canary) { const value = functionToWrap(globalThis, callframe) catch |err| switch (err) { error.JSError => .zero, error.OutOfMemory => globalThis.throwOutOfMemoryValue(), }; - if (comptime bun.Environment.isDebug) { - if (value != .zero) { - if (globalThis.hasException()) { - var formatter = jsc.ConsoleObject.Formatter{ .globalThis = globalThis }; - defer formatter.deinit(); - bun.Output.err("Assertion failed", - \\Native function returned a non-zero JSValue while an exception is pending - \\ - \\ fn: {s} - \\ value: {} - \\ - , .{ - &functionToWrap, // use `(lldb) image lookup --address 0x1ec4` to discover what function failed - value.toFmt(&formatter), - }); - bun.Output.flush(); - } - } - } - bun.assert((value == .zero) == globalThis.hasException()); + debugExceptionAssertion(globalThis, value, functionToWrap); return value; } return @call(.always_inline, functionToWrap, .{ globalThis, callframe }) catch |err| switch (err) { @@ -54,31 +35,12 @@ pub fn toJSHostFn(comptime functionToWrap: JSHostFnZig) JSHostFn { pub fn toJSHostFnWithContext(comptime ContextType: type, comptime Function: JSHostFnZigWithContext(ContextType)) JSHostFunctionTypeWithContext(ContextType) { return struct { pub fn function(ctx: *ContextType, globalThis: *JSGlobalObject, callframe: *CallFrame) callconv(jsc.conv) JSValue { - if (bun.Environment.allow_assert and bun.Environment.is_canary) { + if (Environment.allow_assert and Environment.is_canary) { const value = Function(ctx, globalThis, callframe) catch |err| switch (err) { error.JSError => .zero, error.OutOfMemory => globalThis.throwOutOfMemoryValue(), }; - if (comptime bun.Environment.isDebug) { - if (value != .zero) { - if (globalThis.hasException()) { - var formatter = jsc.ConsoleObject.Formatter{ .globalThis = globalThis }; - defer formatter.deinit(); - bun.Output.err("Assertion failed", - \\Native function returned a non-zero JSValue while an exception is pending - \\ - \\ fn: {s} - \\ value: {} - \\ - , .{ - &Function, // use `(lldb) image lookup --address 0x1ec4` to discover what function failed - value.toFmt(&formatter), - }); - bun.Output.flush(); - } - } - } - bun.assert((value == .zero) == globalThis.hasException()); + debugExceptionAssertion(globalThis, value, Function); return value; } return @call(.always_inline, Function, .{ ctx, globalThis, callframe }) catch |err| switch (err) { @@ -89,8 +51,31 @@ pub fn toJSHostFnWithContext(comptime ContextType: type, comptime Function: JSHo }.function; } +fn debugExceptionAssertion(globalThis: *JSGlobalObject, value: JSValue, comptime func: anytype) void { + if (comptime Environment.isDebug) { + if (value != .zero) { + if (globalThis.hasException()) { + var formatter = jsc.ConsoleObject.Formatter{ .globalThis = globalThis }; + defer formatter.deinit(); + bun.Output.err("Assertion failed", + \\Native function returned a non-zero JSValue while an exception is pending + \\ + \\ fn: {s} + \\ value: {} + \\ + , .{ + &func, // use `(lldb) image lookup --address 0x1ec4` to discover what function failed + value.toFmt(&formatter), + }); + bun.Output.flush(); + } + } + } + bun.assert((value == .zero) == globalThis.hasException()); +} + pub fn toJSHostValue(globalThis: *JSGlobalObject, value: error{ OutOfMemory, JSError }!JSValue) JSValue { - if (bun.Environment.allow_assert and bun.Environment.is_canary) { + if (Environment.allow_assert and Environment.is_canary) { const normal = value catch |err| switch (err) { error.JSError => .zero, error.OutOfMemory => globalThis.throwOutOfMemoryValue(), @@ -124,6 +109,131 @@ inline fn parseErrorSet(T: type, errors: []const std.builtin.Type.Error) ParsedH const DeinitFunction = *const fn (ctx: *anyopaque, buffer: [*]u8, len: usize) callconv(.C) void; +pub fn wrap1(comptime func: anytype) @"return": { + const p = checkWrapParams(func, 1); + break :@"return" fn (p[0].type.?) callconv(.c) JSValue; +} { + const p = @typeInfo(@TypeOf(func)).@"fn".params; + return struct { + pub fn wrapped(arg0: p[0].type.?) callconv(.c) JSValue { + if (Environment.allow_assert and Environment.isDebug) { + const value = func(arg0) catch |err| switch (err) { + error.JSError => .zero, + error.OutOfMemory => arg0.throwOutOfMemoryValue(), + }; + debugExceptionAssertion(arg0, value, func); + return value; + } + return @call(.always_inline, func, .{arg0}) catch |err| switch (err) { + error.JSError => .zero, + error.OutOfMemory => arg0.throwOutOfMemoryValue(), + }; + } + }.wrapped; +} + +pub fn wrap2(comptime func: anytype) @"return": { + const p = checkWrapParams(func, 2); + break :@"return" fn (p[0].type.?, p[1].type.?) callconv(.c) JSValue; +} { + const p = @typeInfo(@TypeOf(func)).@"fn".params; + return struct { + pub fn wrapped(arg0: p[0].type.?, arg1: p[1].type.?) callconv(.c) JSValue { + if (Environment.allow_assert and Environment.isDebug) { + const value = func(arg0, arg1) catch |err| switch (err) { + error.JSError => .zero, + error.OutOfMemory => arg0.throwOutOfMemoryValue(), + }; + debugExceptionAssertion(arg0, value, func); + return value; + } + return @call(.always_inline, func, .{ arg0, arg1 }) catch |err| switch (err) { + error.JSError => .zero, + error.OutOfMemory => arg0.throwOutOfMemoryValue(), + }; + } + }.wrapped; +} + +pub fn wrap3(comptime func: anytype) @"return": { + const p = checkWrapParams(func, 3); + break :@"return" fn (p[0].type.?, p[1].type.?, p[2].type.?) callconv(.c) JSValue; +} { + const p = @typeInfo(@TypeOf(func)).@"fn".params; + return struct { + pub fn wrapped(arg0: p[0].type.?, arg1: p[1].type.?, arg2: p[2].type.?) callconv(.c) JSValue { + if (Environment.allow_assert and Environment.isDebug) { + const value = func(arg0, arg1, arg2) catch |err| switch (err) { + error.JSError => .zero, + error.OutOfMemory => arg0.throwOutOfMemoryValue(), + }; + debugExceptionAssertion(arg0, value, func); + return value; + } + return @call(.always_inline, func, .{ arg0, arg1, arg2 }) catch |err| switch (err) { + error.JSError => .zero, + error.OutOfMemory => arg0.throwOutOfMemoryValue(), + }; + } + }.wrapped; +} + +pub fn wrap4(comptime func: anytype) @"return": { + const p = checkWrapParams(func, 4); + break :@"return" fn (p[0].type.?, p[1].type.?, p[2].type.?, p[3].type.?) callconv(.c) JSValue; +} { + const p = @typeInfo(@TypeOf(func)).@"fn".params; + return struct { + pub fn wrapped(arg0: p[0].type.?, arg1: p[1].type.?, arg2: p[2].type.?, arg3: p[3].type.?) callconv(.c) JSValue { + if (Environment.allow_assert and Environment.isDebug) { + const value = func(arg0, arg1, arg2, arg3) catch |err| switch (err) { + error.JSError => .zero, + error.OutOfMemory => arg0.throwOutOfMemoryValue(), + }; + debugExceptionAssertion(arg0, value, func); + return value; + } + return @call(.always_inline, func, .{ arg0, arg1, arg2, arg3 }) catch |err| switch (err) { + error.JSError => .zero, + error.OutOfMemory => arg0.throwOutOfMemoryValue(), + }; + } + }.wrapped; +} + +pub fn wrap5(comptime func: anytype) @"return": { + const p = checkWrapParams(func, 5); + break :@"return" fn (p[0].type.?, p[1].type.?, p[2].type.?, p[3].type.?, p[4].type.?) callconv(.c) JSValue; +} { + const p = @typeInfo(@TypeOf(func)).@"fn".params; + return struct { + pub fn wrapped(arg0: p[0].type.?, arg1: p[1].type.?, arg2: p[2].type.?, arg3: p[3].type.?, arg4: p[4].type.?) callconv(.c) JSValue { + if (Environment.allow_assert and Environment.isDebug) { + const value = func(arg0, arg1, arg2, arg3, arg4) catch |err| switch (err) { + error.JSError => .zero, + error.OutOfMemory => arg0.throwOutOfMemoryValue(), + }; + debugExceptionAssertion(arg0, value, func); + return value; + } + return @call(.always_inline, func, .{ arg0, arg1, arg2, arg3, arg4 }) catch |err| switch (err) { + error.JSError => .zero, + error.OutOfMemory => arg0.throwOutOfMemoryValue(), + }; + } + }.wrapped; +} + +fn checkWrapParams(comptime func: anytype, comptime N: u8) []const std.builtin.Type.Fn.Param { + const params = @typeInfo(@TypeOf(func)).@"fn".params; + if (params.len != N) { + @compileError(std.fmt.comptimePrint("arg length mismatch: {d} != {d}", .{ N, params.len })); + } else if (params[0].type.? != *JSGlobalObject) { + @compileError("first arg must be *JSGlobalObject"); + } + return params; +} + const private = struct { pub extern fn Bun__CreateFFIFunctionWithDataValue( *JSGlobalObject, @@ -710,3 +820,4 @@ const CallFrame = jsc.CallFrame; const ZigString = jsc.ZigString; const std = @import("std"); const string = []const u8; +const Environment = bun.Environment; diff --git a/src/bun.js/node/node.classes.ts b/src/bun.js/node/node.classes.ts index 09f49b72ca..6fbdc16716 100644 --- a/src/bun.js/node/node.classes.ts +++ b/src/bun.js/node/node.classes.ts @@ -165,13 +165,28 @@ export default [ _destroyed: { getter: "getDestroyed", }, + close: { + fn: "close", + length: 0, + invalidThisBehavior: InvalidThisBehavior.NoOp, + }, + _onTimeout: { + getter: "get_onTimeout", + setter: "set_onTimeout", + this: true, + }, + _idleTimeout: { + getter: "get_idleTimeout", + setter: "set_idleTimeout", + this: true, + }, ["@@dispose"]: { fn: "dispose", length: 0, invalidThisBehavior: InvalidThisBehavior.NoOp, }, }, - values: ["arguments", "callback"], + values: ["arguments", "callback", "idleTimeout"], }), define({ name: "Immediate", diff --git a/src/bun.js/test/expect.zig b/src/bun.js/test/expect.zig index fabf586c5a..c60eb84ab4 100644 --- a/src/bun.js/test/expect.zig +++ b/src/bun.js/test/expect.zig @@ -4956,7 +4956,7 @@ pub const Expect = struct { return globalThis.throw("Expected value must be a non-negative integer: {any}", .{expected.toFmt(&fmt)}); } - const expected_assertions: f64 = expected.coerceToDouble(globalThis); + const expected_assertions: f64 = try expected.toNumber(globalThis); if (@round(expected_assertions) != expected_assertions or std.math.isInf(expected_assertions) or std.math.isNan(expected_assertions) or expected_assertions < 0 or expected_assertions > std.math.maxInt(u32)) { var fmt = JSC.ConsoleObject.Formatter{ .globalThis = globalThis, .quote_strings = true }; return globalThis.throw("Expected value must be a non-negative integer: {any}", .{expected.toFmt(&fmt)}); diff --git a/src/codegen/generate-jssink.ts b/src/codegen/generate-jssink.ts index 2e2d290711..73eb933afc 100644 --- a/src/codegen/generate-jssink.ts +++ b/src/codegen/generate-jssink.ts @@ -908,7 +908,7 @@ default: const { className, controller, prototypeName, controllerPrototypeName, constructor } = names(name); templ += ` -extern "C" JSC__JSValue ${name}__createObject(JSC__JSGlobalObject* arg0, void* sinkPtr, uintptr_t destructor) +extern "C" JSC::EncodedJSValue ${name}__createObject(JSC::JSGlobalObject* arg0, void* sinkPtr, uintptr_t destructor) { auto& vm = arg0->vm(); Zig::GlobalObject* globalObject = reinterpret_cast(arg0); @@ -927,7 +927,7 @@ extern "C" void* ${name}__fromJS(JSC::EncodedJSValue value) return (void*)1; } -extern "C" void ${name}__detachPtr(JSC__JSValue JSValue0) +extern "C" void ${name}__detachPtr(JSC::EncodedJSValue JSValue0) { if (auto* sink = JSC::jsDynamicCast(JSC::JSValue::decode(JSValue0))) { sink->detach(); @@ -941,7 +941,7 @@ extern "C" void ${name}__detachPtr(JSC__JSValue JSValue0) } } -extern "C" JSC__JSValue ${name}__assignToStream(JSC__JSGlobalObject* arg0, JSC__JSValue stream, void* sinkPtr, void **controllerValue) +extern "C" JSC::EncodedJSValue ${name}__assignToStream(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue stream, void* sinkPtr, void **controllerValue) { auto& vm = arg0->vm(); Zig::GlobalObject* globalObject = reinterpret_cast(arg0); @@ -952,7 +952,7 @@ extern "C" JSC__JSValue ${name}__assignToStream(JSC__JSGlobalObject* arg0, JSC__ return globalObject->assignToStream(JSC::JSValue::decode(stream), controller); } -extern "C" void ${name}__onReady(JSC__JSValue controllerValue, JSC__JSValue amt, JSC__JSValue offset) +extern "C" void ${name}__onReady(JSC::EncodedJSValue controllerValue, JSC::EncodedJSValue amt, JSC::EncodedJSValue offset) { WebCore::${controller}* controller = JSC::jsCast(JSC::JSValue::decode(controllerValue).getObject()); @@ -970,12 +970,12 @@ extern "C" void ${name}__onReady(JSC__JSValue controllerValue, JSC__JSValue amt, RELEASE_AND_RETURN(scope, void()); } -extern "C" void ${name}__onStart(JSC__JSValue controllerValue) +extern "C" void ${name}__onStart(JSC::EncodedJSValue controllerValue) { } -extern "C" void ${name}__onClose(JSC__JSValue controllerValue, JSC__JSValue reason) +extern "C" void ${name}__onClose(JSC::EncodedJSValue controllerValue, JSC::EncodedJSValue reason) { WebCore::${controller}* controller = JSC::jsCast(JSC::JSValue::decode(controllerValue).getObject()); diff --git a/src/sql/postgres.zig b/src/sql/postgres.zig index f4ba220df3..2c2eeebd30 100644 --- a/src/sql/postgres.zig +++ b/src/sql/postgres.zig @@ -982,7 +982,7 @@ pub const PostgresRequest = struct { }, .float8 => { const l = try writer.length(); - try writer.f64(@bitCast(value.coerceToDouble(globalObject))); + try writer.f64(@bitCast(try value.toNumber(globalObject))); try l.writeExcludingSelf(); }, diff --git a/test/js/node/test/parallel/test-timers-unenroll-unref-interval.js b/test/js/node/test/parallel/test-timers-unenroll-unref-interval.js new file mode 100644 index 0000000000..f0e965296f --- /dev/null +++ b/test/js/node/test/parallel/test-timers-unenroll-unref-interval.js @@ -0,0 +1,48 @@ +'use strict'; + +const common = require('../common'); + +{ + const interval = setInterval(common.mustCall(() => { + clearTimeout(interval); + }), 1).unref(); +} + +{ + const interval = setInterval(common.mustCall(() => { + interval.close(); + }), 1).unref(); +} + +{ + const interval = setInterval(common.mustCall(() => { + clearInterval(interval); + }), 1).unref(); +} + +{ + const interval = setInterval(common.mustCall(() => { + interval._idleTimeout = -1; + }), 1).unref(); +} + +{ + const interval = setInterval(common.mustCall(() => { + interval._onTimeout = null; + }), 1).unref(); +} + +// Use timers' intrinsic behavior to keep this open +// exactly long enough for the problem to manifest. +// +// See https://github.com/nodejs/node/issues/9561 +// +// Since this is added after it will always fire later +// than the previous timeouts, unrefed or not. +// +// Keep the event loop alive for one timeout and then +// another. Any problems will occur when the second +// should be called but before it is able to be. +setTimeout(common.mustCall(() => { + setTimeout(common.mustCall(), 1); +}), 1); diff --git a/test/js/web/timers/setInterval.test.js b/test/js/web/timers/setInterval.test.js index 21d9c7fb8c..1dc6b7c98f 100644 --- a/test/js/web/timers/setInterval.test.js +++ b/test/js/web/timers/setInterval.test.js @@ -109,6 +109,10 @@ it("setInterval runs with at least the delay time", () => { expect([`run`, join(import.meta.dir, "setInterval-fixture.js")]).toRun(); }); +it("setInterval canceling with unref, close, _idleTimeout, and _onTimeout", () => { + expect([join(import.meta.dir, "timers-fixture-unref.js"), "setInterval"]).toRun(); +}); + it( "setInterval doesn't leak memory", () => { diff --git a/test/js/web/timers/setTimeout.test.js b/test/js/web/timers/setTimeout.test.js index af7a143284..fe8797bd56 100644 --- a/test/js/web/timers/setTimeout.test.js +++ b/test/js/web/timers/setTimeout.test.js @@ -362,3 +362,7 @@ it("Returning a Promise in setTimeout doesnt keep the event loop alive forever", it("Returning a Promise in setTimeout (unref'd) doesnt keep the event loop alive forever", async () => { expect([path.join(import.meta.dir, "setTimeout-unref-fixture-7.js")]).toRun(); }); + +it("setTimeout canceling with unref, close, _idleTimeout, and _onTimeout", () => { + expect([path.join(import.meta.dir, "timers-fixture-unref.js"), "setInterval"]).toRun(); +}); diff --git a/test/js/web/timers/timers-fixture-unref.js b/test/js/web/timers/timers-fixture-unref.js new file mode 100644 index 0000000000..d69ea64ddf --- /dev/null +++ b/test/js/web/timers/timers-fixture-unref.js @@ -0,0 +1,94 @@ +const { mustCall } = require("../../node/test/common"); + +var setTimer; +if (process.argv[2] === "setTimeout") { + setTimer = setTimeout; +} else if (process.argv[2] === "setInterval") { + setTimer = setInterval; +} else { + throw new Error("Invalid process argument: " + process.argv[2]); +} + +{ + const interval = setTimer( + mustCall(() => { + clearTimeout(interval); + }), + 1, + ).unref(); +} + +{ + const interval = setTimer( + mustCall(() => { + interval.close(); + }), + 1, + ).unref(); +} + +{ + const interval = setTimer( + mustCall(() => { + clearInterval(interval); + }), + 1, + ).unref(); +} + +{ + const interval = setTimer( + mustCall(() => { + interval._idleTimeout = -1; + }), + 1, + ).unref(); +} + +{ + const interval = setTimer( + mustCall(() => { + interval._idleTimeout = -1; + interval.refresh(); + }), + ); +} + +// refresh is called before _idleTimeout is set to -1 +// giving the timer a chance to reschedule once before +// -1 has an effect +{ + const interval = setTimer( + mustCall(() => { + interval.refresh(); + interval._idleTimeout = -1; + }, 2), + ); +} + +{ + const interval = setTimer( + mustCall(() => { + interval._onTimeout = null; + }), + 1, + ).unref(); +} + +// Use timers' intrinsic behavior to keep this open +// exactly long enough for the problem to manifest. +// +// See https://github.com/nodejs/node/issues/9561 +// +// Since this is added after it will always fire later +// than the previous timeouts, unrefed or not. +// +// Keep the event loop alive for one timeout and then +// another. Any problems will occur when the second +// should be called but before it is able to be. +setTimeout( + mustCall(() => { + setTimeout(mustCall(), 1); + }), + 1, +);