aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bun.js/bindings/bindings.zig11
-rw-r--r--src/bun.js/bindings/header-gen.zig28
-rw-r--r--src/bun.js/bindings/headers-cpp.h6
-rw-r--r--src/bun.js/bindings/headers.h34
-rw-r--r--src/bun.js/bindings/headers.zig5
-rw-r--r--src/bun.js/javascript.zig4
6 files changed, 30 insertions, 58 deletions
diff --git a/src/bun.js/bindings/bindings.zig b/src/bun.js/bindings/bindings.zig
index 2c6f634a9..5e4c6f5b9 100644
--- a/src/bun.js/bindings/bindings.zig
+++ b/src/bun.js/bindings/bindings.zig
@@ -5756,14 +5756,9 @@ pub const __DOMCall__reader_f64 = @import("../api/bun.zig").FFIObject.Reader.DOM
pub const __DOMCall__reader_i64 = @import("../api/bun.zig").FFIObject.Reader.DOMCalls.i64;
pub const __DOMCall__reader_u64 = @import("../api/bun.zig").FFIObject.Reader.DOMCalls.u64;
pub const __DOMCall__reader_intptr = @import("../api/bun.zig").FFIObject.Reader.DOMCalls.intptr;
-pub const __Crypto_getRandomValues = @import("../webcore.zig").Crypto.Class.functionDefinitions.getRandomValues;
-pub const __Crypto_randomUUID = @import("../webcore.zig").Crypto.Class.functionDefinitions.randomUUID;
-pub const __Crypto_randomInt = @import("../webcore.zig").Crypto.Class.functionDefinitions.randomInt;
-pub const __Crypto_timingSafeEqual = @import("../webcore.zig").Crypto.Class.functionDefinitions.timingSafeEqual;
-pub const DOMCalls = .{
- @import("../api/bun.zig").FFI,
- @import("../api/bun.zig").FFI.Reader,
- @import("../webcore.zig").Crypto,
+pub const DOMCalls = &.{
+ .{ .ptr = @import("../api/bun.zig").FFIObject.dom_call },
+ @import("../api/bun.zig").FFIObject.Reader.DOMCalls,
};
extern "c" fn JSCInitialize(env: [*]const [*:0]u8, count: usize, cb: *const fn ([*]const u8, len: usize) callconv(.C) void) void;
diff --git a/src/bun.js/bindings/header-gen.zig b/src/bun.js/bindings/header-gen.zig
index 2c871b15f..e27bd286f 100644
--- a/src/bun.js/bindings/header-gen.zig
+++ b/src/bun.js/bindings/header-gen.zig
@@ -727,22 +727,30 @@ pub fn HeaderGen(comptime first_import: type, comptime second_import: type, comp
all_types[0] = first_import;
all_types[1] = second_import;
var counter: usize = 2;
- inline for (first_import.DOMCalls) |Type| {
- inline for (std.meta.fieldNames(@TypeOf(Type.Class.functionDefinitions))) |static_function_name| {
- const static_function = @field(Type.Class.functionDefinitions, static_function_name);
- if (@TypeOf(static_function) == type and @hasDecl(static_function, "is_dom_call")) {
- all_types[counter] = static_function;
- counter += 1;
- }
+ inline for (first_import.DOMCalls) |Type_| {
+ const Type = if (@typeInfo(@TypeOf(Type_)) == .Pointer)
+ @typeInfo(@TypeOf(Type_)).Pointer.child
+ else
+ @TypeOf(Type_);
+
+ inline for (bun.meta.fieldNames(Type)) |static_function_name| {
+ const static_function = @field(Type_, static_function_name);
+ all_types[counter] = static_function;
+ counter += 1;
}
}
break :brk all_types[0..counter];
};
- inline for (first_import.DOMCalls) |Type| {
- inline for (comptime std.meta.fieldNames(@TypeOf(Type.Class.functionDefinitions))) |static_function_name| {
- const static_function = @field(Type.Class.functionDefinitions, static_function_name);
+ inline for (first_import.DOMCalls) |Type_| {
+ const Type = if (@typeInfo(@TypeOf(Type_)) == .Pointer)
+ @typeInfo(@TypeOf(Type_)).Pointer.child
+ else
+ @TypeOf(Type_);
+
+ inline for (comptime bun.meta.fieldNames(Type)) |static_function_name| {
+ const static_function = comptime @field(Type_, static_function_name);
if (comptime @TypeOf(static_function) == type and @hasDecl(static_function, "is_dom_call")) {
dom_writer.writeAll("\n\n") catch unreachable;
static_function.printGenerateDOMJITSignature(@TypeOf(&dom_writer), &dom_writer) catch unreachable;
diff --git a/src/bun.js/bindings/headers-cpp.h b/src/bun.js/bindings/headers-cpp.h
index 0ccc2fa8c..1ed495dad 100644
--- a/src/bun.js/bindings/headers-cpp.h
+++ b/src/bun.js/bindings/headers-cpp.h
@@ -182,8 +182,8 @@ extern "C" const size_t Zig__ConsoleClient_object_align_ = alignof(Zig::ConsoleC
extern "C" const size_t Bun__Timer_object_size_ = sizeof(Bun__Timer);
extern "C" const size_t Bun__Timer_object_align_ = alignof(Bun__Timer);
-const size_t sizes[41] = {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(Crypto__getRandomValues), sizeof(Crypto__randomUUID), sizeof(Crypto__timingSafeEqual), sizeof(Zig::GlobalObject), sizeof(Bun__Path), sizeof(ArrayBufferSink), sizeof(HTTPSResponseSink), sizeof(HTTPResponseSink), sizeof(FileSink)};
+const size_t sizes[38] = {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)};
-const char* names[41] = {"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", "Crypto__getRandomValues", "Crypto__randomUUID", "Crypto__timingSafeEqual", "Zig__GlobalObject", "Bun__Path", "ArrayBufferSink", "HTTPSResponseSink", "HTTPResponseSink", "FileSink"};
+const char* names[38] = {"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"};
-const size_t aligns[41] = {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(Crypto__getRandomValues), alignof(Crypto__randomUUID), alignof(Crypto__timingSafeEqual), alignof(Zig::GlobalObject), alignof(Bun__Path), alignof(ArrayBufferSink), alignof(HTTPSResponseSink), alignof(HTTPResponseSink), alignof(FileSink)};
+const size_t aligns[38] = {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)};
diff --git a/src/bun.js/bindings/headers.h b/src/bun.js/bindings/headers.h
index 29064ffab..96087b5ff 100644
--- a/src/bun.js/bindings/headers.h
+++ b/src/bun.js/bindings/headers.h
@@ -81,7 +81,6 @@ typedef void* JSClassRef;
typedef bJSC__JSCell JSC__JSCell; // JSC::JSCell
typedef bJSC__JSGlobalObject JSC__JSGlobalObject; // JSC::JSGlobalObject
typedef struct WebCore__AbortSignal WebCore__AbortSignal; // WebCore::AbortSignal
- typedef JSClassRef JSClassRef;
typedef bJSC__JSInternalPromise JSC__JSInternalPromise; // JSC::JSInternalPromise
typedef WebSocketHTTPSClient WebSocketHTTPSClient;
@@ -121,7 +120,6 @@ typedef void* JSClassRef;
typedef ErrorableString ErrorableString;
typedef SystemError SystemError;
typedef Uint8Array_alias Uint8Array_alias;
- typedef JSClassRef JSClassRef;
typedef WebSocketHTTPSClient WebSocketHTTPSClient;
using JSC__JSGlobalObject = JSC::JSGlobalObject;
using JSC__Exception = JSC::Exception;
@@ -556,34 +554,10 @@ ZIG_DECL JSC__JSValue Reader__intptr__fastpath(JSC__JSGlobalObject* arg0, void*
ZIG_DECL JSC__JSValue Reader__intptr__slowpath(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue* arg2, size_t arg3);
#endif
-CPP_DECL void Crypto__getRandomValues__put(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1);
-
-#ifdef __cplusplus
-
-ZIG_DECL JSC__JSValue Crypto__getRandomValues__fastpath(JSC__JSGlobalObject* arg0, void* arg1, Uint8Array_alias* arg2);
-ZIG_DECL JSC__JSValue Crypto__getRandomValues__slowpath(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue* arg2, size_t arg3);
-
-#endif
-CPP_DECL void Crypto__randomUUID__put(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1);
-
-#ifdef __cplusplus
-
-ZIG_DECL JSC__JSValue Crypto__randomUUID__fastpath(JSC__JSGlobalObject* arg0, void* arg1);
-ZIG_DECL JSC__JSValue Crypto__randomUUID__slowpath(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue* arg2, size_t arg3);
-
-#endif
-CPP_DECL void Crypto__timingSafeEqual__put(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1);
-
-#ifdef __cplusplus
-
-ZIG_DECL JSC__JSValue Crypto__timingSafeEqual__fastpath(JSC__JSGlobalObject* arg0, void* arg1, Uint8Array_alias* arg2, Uint8Array_alias* arg3);
-ZIG_DECL JSC__JSValue Crypto__timingSafeEqual__slowpath(JSC__JSGlobalObject* arg0, JSC__JSValue JSValue1, JSC__JSValue* arg2, size_t arg3);
-
-#endif
#pragma mark - Zig::GlobalObject
-CPP_DECL JSC__JSGlobalObject* Zig__GlobalObject__create(void* arg2, int32_t arg3, bool arg4, void* arg5);
+CPP_DECL JSC__JSGlobalObject* Zig__GlobalObject__create(void* arg0, int32_t arg1, bool arg2, void* arg3);
CPP_DECL void* Zig__GlobalObject__getModuleRegistryMap(JSC__JSGlobalObject* arg0);
CPP_DECL bool Zig__GlobalObject__resetModuleRegistryMap(JSC__JSGlobalObject* arg0, void* arg1);
@@ -598,12 +572,6 @@ ZIG_DECL void Zig__GlobalObject__resolve(ErrorableString* arg0, JSC__JSGlobalObj
#endif
-#ifdef __cplusplus
-
-ZIG_DECL bool Zig__ErrorType__isPrivateData(void* arg0);
-
-#endif
-
#pragma mark - Bun__Path
CPP_DECL JSC__JSValue Bun__Path__create(JSC__JSGlobalObject* arg0, bool arg1);
diff --git a/src/bun.js/bindings/headers.zig b/src/bun.js/bindings/headers.zig
index 7794ac096..a696e86b1 100644
--- a/src/bun.js/bindings/headers.zig
+++ b/src/bun.js/bindings/headers.zig
@@ -352,10 +352,7 @@ pub extern fn Reader__f64__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JS
pub extern fn Reader__i64__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void;
pub extern fn Reader__u64__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void;
pub extern fn Reader__intptr__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void;
-pub extern fn Crypto__getRandomValues__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void;
-pub extern fn Crypto__randomUUID__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void;
-pub extern fn Crypto__timingSafeEqual__put(arg0: *bindings.JSGlobalObject, JSValue1: JSC__JSValue) void;
-pub extern fn Zig__GlobalObject__create(arg2: ?*anyopaque, arg3: i32, arg4: bool, arg5: ?*anyopaque) *bindings.JSGlobalObject;
+pub extern fn Zig__GlobalObject__create(arg0: ?*anyopaque, arg1: i32, arg2: bool, arg3: ?*anyopaque) *bindings.JSGlobalObject;
pub extern fn Zig__GlobalObject__getModuleRegistryMap(arg0: *bindings.JSGlobalObject) ?*anyopaque;
pub extern fn Zig__GlobalObject__resetModuleRegistryMap(arg0: *bindings.JSGlobalObject, arg1: ?*anyopaque) bool;
pub extern fn Bun__Path__create(arg0: *bindings.JSGlobalObject, arg1: bool) JSC__JSValue;
diff --git a/src/bun.js/javascript.zig b/src/bun.js/javascript.zig
index 41ede995b..1b9520dde 100644
--- a/src/bun.js/javascript.zig
+++ b/src/bun.js/javascript.zig
@@ -713,6 +713,7 @@ pub const VirtualMachine = struct {
pub fn create(this: *VirtualMachine, globalObject: *JSGlobalObject) !void {
debug("create", .{});
+ JSC.markBinding(@src());
this.debugger.?.script_execution_context_id = Bun__createJSDebugger(globalObject);
if (!has_started_debugger_thread) {
has_started_debugger_thread = true;
@@ -739,6 +740,7 @@ pub const VirtualMachine = struct {
var arena = bun.MimallocArena.init() catch unreachable;
Output.Source.configureNamedThread("Debugger");
debug("startJSDebuggerThread", .{});
+ JSC.markBinding(@src());
var vm = JSC.VirtualMachine.init(.{
.allocator = arena.allocator(),
@@ -758,6 +760,8 @@ pub const VirtualMachine = struct {
pub export var Bun__debugger_server_url: bun.String = undefined;
fn start(other_vm: *VirtualMachine) void {
+ JSC.markBinding(@src());
+
var this = VirtualMachine.get();
var str = bun.String.create(other_vm.debugger.?.path_or_port);
Bun__debugger_server_url = Bun__startJSDebuggerThread(this.global, other_vm.debugger.?.script_execution_context_id, &str);