From 35b2ea870dcdd64e4d8fa8b769f05b3f4d0d727b Mon Sep 17 00:00:00 2001 From: Karl Seguin Date: Tue, 6 May 2025 22:01:32 +0800 Subject: [PATCH 01/10] use zig-v8-fork v8_upgrade branch --- .github/actions/install/action.yml | 2 +- Dockerfile | 2 +- build.zig | 34 +++++++------ build.zig.zon | 6 +-- src/runtime/js.zig | 40 ++++++++-------- src/runtime/test_object_types.zig | 76 +++++++++++++++--------------- 6 files changed, 81 insertions(+), 79 deletions(-) diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index 51de6e87d..879ca597d 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -17,7 +17,7 @@ inputs: zig-v8: description: 'zig v8 version to install' required: false - default: 'v0.1.21' + default: 'v0.1.22' v8: description: 'v8 version to install' required: false diff --git a/Dockerfile b/Dockerfile index af08c5b69..6944a0114 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ARG ZIG=0.14.0 ARG ZIG_MINISIG=RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U ARG ARCH=x86_64 ARG V8=11.1.134 -ARG ZIG_V8=v0.1.21 +ARG ZIG_V8=v0.1.22 RUN apt-get update -yq && \ apt-get install -yq xz-utils \ diff --git a/build.zig b/build.zig index 160e3c3f1..8f38170c7 100644 --- a/build.zig +++ b/build.zig @@ -158,29 +158,27 @@ fn common(b: *std.Build, opts: *std.Build.Step.Options, step: *std.Build.Step.Co mod.addImport("v8", v8_mod); } - const mode_str: []const u8 = if (mod.optimize.? == .Debug) "debug" else "release"; - - // FIXME: we are tied to native v8 builds, currently: - // - aarch64-macos - // - x86_64-linux - const os = target.result.os.tag; - const arch = target.result.cpu.arch; - switch (os) { - .macos => {}, - .linux => { - // TODO: why do we need it? It should be linked already when we built v8 - mod.link_libcpp = true; - }, - else => return error.OsNotSupported, - } - const lib_path = try std.fmt.allocPrint( mod.owner.allocator, - "v8/build/{s}-{s}/{s}/ninja/obj/zig/libc_v8.a", - .{ @tagName(arch), @tagName(os), mode_str }, + "v8/out/{s}/obj/zig/libc_v8.a", + .{ if (mod.optimize.? == .Debug) "debug" else "release" }, ); + mod.link_libcpp = true; mod.addObjectFile(mod.owner.path(lib_path)); + mod.addIncludePath(b.path("src/runtime/v8")); + + switch (target.result.os.tag) { + .macos => { + // v8 has a dependency, abseil-cpp, which, on Mac, uses CoreFoundation + mod.addSystemFrameworkPath(.{ .cwd_relative = "/System/Library/Frameworks" }); + mod.linkFramework("CoreFoundation", .{}); + }, + else => {}, + } + mod.addImport("build_info", opts.createModule()); + mod.addObjectFile(mod.owner.path(lib_path)); + } fn moduleNetSurf(b: *std.Build, step: *std.Build.Step.Compile, target: std.Build.ResolvedTarget) !void { diff --git a/build.zig.zon b/build.zig.zon index e5e4b8f52..e507a753c 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -13,10 +13,10 @@ .hash = "tigerbeetle_io-0.0.0-ViLgxpyRBAB5BMfIcj3KMXfbJzwARs9uSl8aRy2OXULd", }, .v8 = .{ - .url = "https://github.com/lightpanda-io/zig-v8-fork/archive/fc764e7d29bc1514924e8df09255a057e03d453a.tar.gz", - .hash = "v8-0.0.0-xddH6zUZIQBJf109L94sC-mWH1NJXWCnOJGJttKtfasI", + .url = "https://github.com/lightpanda-io/zig-v8-fork/archive/4809111f930293c6d5082971ad7ffc3d822b6f37.tar.gz", + .hash = "v8-0.0.0-xddH632xAwAjF7ieh48tjbMpu7fVVGr3r3aLwmBbFvPk", }, - //.v8 = .{ .path = "../zig-v8-fork" }, + // .v8 = .{ .path = "../zig-v8-fork" }, //.tigerbeetle_io = .{ .path = "../tigerbeetle-io" }, }, } diff --git a/src/runtime/js.zig b/src/runtime/js.zig index 86d4cb303..e5548d289 100644 --- a/src/runtime/js.zig +++ b/src/runtime/js.zig @@ -594,7 +594,7 @@ pub fn Env(comptime State: type, comptime WebApis: type) type { var origin: ?v8.ScriptOrigin = null; if (name) |n| { const scr_name = v8.String.initUtf8(isolate, n); - origin = v8.ScriptOrigin.initDefault(self.isolate, scr_name.toValue()); + origin = v8.ScriptOrigin.initDefault(scr_name.toValue()); } const scr_js = v8.String.initUtf8(isolate, src); const scr = v8.Script.compile(context, scr_js, origin) catch { @@ -1142,7 +1142,6 @@ pub fn Env(comptime State: type, comptime WebApis: type) type { const script_source = v8.String.initUtf8(isolate, src); const origin = v8.ScriptOrigin.init( - isolate, script_name.toValue(), 0, // resource_line_offset 0, // resource_column_offset @@ -1201,14 +1200,15 @@ pub fn Env(comptime State: type, comptime WebApis: type) type { if (@hasDecl(Struct, "get_symbol_toStringTag") == false) { // If this WAS defined, then we would have created it in generateProperty. // But if it isn't, we create a default one - const key = v8.Symbol.getToStringTag(isolate).toName(); - template_proto.setGetter(key, struct { - fn stringTag(_: ?*const v8.C_Name, raw_info: ?*const v8.C_PropertyCallbackInfo) callconv(.c) void { - const info = v8.PropertyCallbackInfo.initFromV8(raw_info); + const string_tag_callback = v8.FunctionTemplate.initCallback(isolate, struct { + fn stringTag(raw_info: ?*const v8.C_FunctionCallbackInfo) callconv(.c) void { + const info = v8.FunctionCallbackInfo.initFromV8(raw_info); const class_name = v8.String.initUtf8(info.getIsolate(), comptime classNameForStruct(Struct)); info.getReturnValue().set(class_name); } }.stringTag); + const key = v8.Symbol.getToStringTag(isolate).toName(); + template_proto.setAccessorGetter(key, string_tag_callback); } generateIndexer(Struct, template_proto); @@ -1309,9 +1309,9 @@ pub fn Env(comptime State: type, comptime WebApis: type) type { js_name = v8.String.initUtf8(isolate, name).toName(); } - const getter_callback = struct { - fn callback(_: ?*const v8.C_Name, raw_info: ?*const v8.C_PropertyCallbackInfo) callconv(.c) void { - const info = v8.PropertyCallbackInfo.initFromV8(raw_info); + const getter_callback = v8.FunctionTemplate.initCallback(isolate, struct { + fn callback(raw_info: ?*const v8.C_FunctionCallbackInfo) callconv(.c) void { + const info = v8.FunctionCallbackInfo.initFromV8(raw_info); var caller = Caller(Self, State).init(info); defer caller.deinit(); @@ -1320,28 +1320,30 @@ pub fn Env(comptime State: type, comptime WebApis: type) type { caller.handleError(Struct, named_function, err, info); }; } - }.callback; + }.callback); const setter_name = "set_" ++ name; if (@hasDecl(Struct, setter_name) == false) { - template_proto.setGetter(js_name, getter_callback); + template_proto.setAccessorGetter(js_name, getter_callback); return; } - const setter_callback = struct { - fn callback(_: ?*const v8.C_Name, raw_value: ?*const v8.C_Value, raw_info: ?*const v8.C_PropertyCallbackInfo) callconv(.c) void { - const info = v8.PropertyCallbackInfo.initFromV8(raw_info); + const setter_callback = v8.FunctionTemplate.initCallback(isolate, struct { + fn callback(raw_info: ?*const v8.C_FunctionCallbackInfo) callconv(.c) void { + const info = v8.FunctionCallbackInfo.initFromV8(raw_info); var caller = Caller(Self, State).init(info); defer caller.deinit(); - const js_value = v8.Value{ .handle = raw_value.? }; + std.debug.assert(info.length() == 1); + const js_value = info.getArg(0); const named_function = comptime NamedFunction.init(Struct, "set_" ++ name); caller.setter(Struct, named_function, js_value, info) catch |err| { caller.handleError(Struct, named_function, err, info); }; } - }.callback; - template_proto.setGetterAndSetter(js_name, getter_callback, setter_callback); + }.callback); + + template_proto.setAccessorGetterAndSetter(js_name, getter_callback, setter_callback); } fn generateIndexer(comptime Struct: type, template_proto: v8.ObjectTemplate) void { @@ -1762,7 +1764,7 @@ fn Caller(comptime E: type, comptime State: type) type { info.getReturnValue().set(try self.zigValueToJs(res)); } - fn getter(self: *Self, comptime Struct: type, comptime named_function: NamedFunction, info: v8.PropertyCallbackInfo) !void { + fn getter(self: *Self, comptime Struct: type, comptime named_function: NamedFunction, info: v8.FunctionCallbackInfo) !void { const func = @field(Struct, named_function.name); const Getter = @TypeOf(func); if (@typeInfo(Getter).@"fn".return_type == null) { @@ -1788,7 +1790,7 @@ fn Caller(comptime E: type, comptime State: type) type { info.getReturnValue().set(try self.zigValueToJs(res)); } - fn setter(self: *Self, comptime Struct: type, comptime named_function: NamedFunction, js_value: v8.Value, info: v8.PropertyCallbackInfo) !void { + fn setter(self: *Self, comptime Struct: type, comptime named_function: NamedFunction, js_value: v8.Value, info: v8.FunctionCallbackInfo) !void { const func = @field(Struct, named_function.name); comptime assertSelfReceiver(Struct, named_function); diff --git a/src/runtime/test_object_types.zig b/src/runtime/test_object_types.zig index b3594dc01..e14483cce 100644 --- a/src/runtime/test_object_types.zig +++ b/src/runtime/test_object_types.zig @@ -45,18 +45,18 @@ pub const MyObject = struct { }; } - pub fn named_get(_: *const MyObject, name: []const u8, has_value: *bool) ?OtherUnion { - if (std.mem.eql(u8, name, "a")) { - has_value.* = true; - return .{ .Other = .{ .val = 4 } }; - } - if (std.mem.eql(u8, name, "c")) { - has_value.* = true; - return .{ .Bool = true }; - } - has_value.* = false; - return null; - } + // pub fn named_get(_: *const MyObject, name: []const u8, has_value: *bool) ?OtherUnion { + // if (std.mem.eql(u8, name, "a")) { + // has_value.* = true; + // return .{ .Other = .{ .val = 4 } }; + // } + // if (std.mem.eql(u8, name, "c")) { + // has_value.* = true; + // return .{ .Bool = true }; + // } + // has_value.* = false; + // return null; + // } pub fn get_val(self: *const MyObject) bool { return self.val; @@ -95,29 +95,31 @@ test "JS: object types" { defer runner.deinit(); // v8 has 5 default "own" properties - const own_base = "5"; - - try runner.testCases(&.{ - .{ "Object.getOwnPropertyNames(MyObject).length;", own_base }, - .{ "let myObj = new MyObject(true);", "undefined" }, - // check object property - .{ "myObj.a.val()", "4" }, - .{ "myObj.b", "undefined" }, - .{ "Object.getOwnPropertyNames(myObj).length;", "0" }, - - // check if setter (pointer) still works - .{ "myObj.val", "true" }, - .{ "myObj.val = false", "false" }, - .{ "myObj.val", "false" }, - - .{ "let myObj2 = new MyObject(false);", "undefined" }, - .{ "myObj2.c", "true" }, - }, .{}); - - try runner.testCases(&.{ - .{ "let myAPI = new MyAPI();", "undefined" }, - .{ "let myObjIndirect = myAPI.obj();", "undefined" }, - // check object property - .{ "myObjIndirect.a.val()", "4" }, - }, .{}); + + // TODO: v8 upgrade + // const own_base = "5"; + + // try runner.testCases(&.{ + // .{ "Object.getOwnPropertyNames(MyObject).length;", own_base }, + // .{ "let myObj = new MyObject(true);", "undefined" }, + // // check object property + // .{ "myObj.a.val()", "4" }, + // .{ "myObj.b", "undefined" }, + // .{ "Object.getOwnPropertyNames(myObj).length;", "0" }, + + // // check if setter (pointer) still works + // .{ "myObj.val", "true" }, + // .{ "myObj.val = false", "false" }, + // .{ "myObj.val", "false" }, + + // .{ "let myObj2 = new MyObject(false);", "undefined" }, + // .{ "myObj2.c", "true" }, + // }, .{}); + + // try runner.testCases(&.{ + // .{ "let myAPI = new MyAPI();", "undefined" }, + // .{ "let myObjIndirect = myAPI.obj();", "undefined" }, + // // check object property + // .{ "myObjIndirect.a.val()", "4" }, + // }, .{}); } From b542762dcebd0fc5be6af924afba7f5e482689ea Mon Sep 17 00:00:00 2001 From: Karl Seguin Date: Wed, 7 May 2025 20:12:59 +0800 Subject: [PATCH 02/10] update zig-v8 dep for proper named property masking flag --- src/runtime/test_object_types.zig | 76 +++++++++++++++---------------- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/src/runtime/test_object_types.zig b/src/runtime/test_object_types.zig index e14483cce..b3594dc01 100644 --- a/src/runtime/test_object_types.zig +++ b/src/runtime/test_object_types.zig @@ -45,18 +45,18 @@ pub const MyObject = struct { }; } - // pub fn named_get(_: *const MyObject, name: []const u8, has_value: *bool) ?OtherUnion { - // if (std.mem.eql(u8, name, "a")) { - // has_value.* = true; - // return .{ .Other = .{ .val = 4 } }; - // } - // if (std.mem.eql(u8, name, "c")) { - // has_value.* = true; - // return .{ .Bool = true }; - // } - // has_value.* = false; - // return null; - // } + pub fn named_get(_: *const MyObject, name: []const u8, has_value: *bool) ?OtherUnion { + if (std.mem.eql(u8, name, "a")) { + has_value.* = true; + return .{ .Other = .{ .val = 4 } }; + } + if (std.mem.eql(u8, name, "c")) { + has_value.* = true; + return .{ .Bool = true }; + } + has_value.* = false; + return null; + } pub fn get_val(self: *const MyObject) bool { return self.val; @@ -95,31 +95,29 @@ test "JS: object types" { defer runner.deinit(); // v8 has 5 default "own" properties - - // TODO: v8 upgrade - // const own_base = "5"; - - // try runner.testCases(&.{ - // .{ "Object.getOwnPropertyNames(MyObject).length;", own_base }, - // .{ "let myObj = new MyObject(true);", "undefined" }, - // // check object property - // .{ "myObj.a.val()", "4" }, - // .{ "myObj.b", "undefined" }, - // .{ "Object.getOwnPropertyNames(myObj).length;", "0" }, - - // // check if setter (pointer) still works - // .{ "myObj.val", "true" }, - // .{ "myObj.val = false", "false" }, - // .{ "myObj.val", "false" }, - - // .{ "let myObj2 = new MyObject(false);", "undefined" }, - // .{ "myObj2.c", "true" }, - // }, .{}); - - // try runner.testCases(&.{ - // .{ "let myAPI = new MyAPI();", "undefined" }, - // .{ "let myObjIndirect = myAPI.obj();", "undefined" }, - // // check object property - // .{ "myObjIndirect.a.val()", "4" }, - // }, .{}); + const own_base = "5"; + + try runner.testCases(&.{ + .{ "Object.getOwnPropertyNames(MyObject).length;", own_base }, + .{ "let myObj = new MyObject(true);", "undefined" }, + // check object property + .{ "myObj.a.val()", "4" }, + .{ "myObj.b", "undefined" }, + .{ "Object.getOwnPropertyNames(myObj).length;", "0" }, + + // check if setter (pointer) still works + .{ "myObj.val", "true" }, + .{ "myObj.val = false", "false" }, + .{ "myObj.val", "false" }, + + .{ "let myObj2 = new MyObject(false);", "undefined" }, + .{ "myObj2.c", "true" }, + }, .{}); + + try runner.testCases(&.{ + .{ "let myAPI = new MyAPI();", "undefined" }, + .{ "let myObjIndirect = myAPI.obj();", "undefined" }, + // check object property + .{ "myObjIndirect.a.val()", "4" }, + }, .{}); } From 3993f9c2bb2df61bd9cd7a52741998fdd0400d8e Mon Sep 17 00:00:00 2001 From: Karl Seguin Date: Thu, 8 May 2025 15:43:16 +0800 Subject: [PATCH 03/10] update to latest zig-v8-fork add unzip to apt get install sample --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d9760ab5f..60c001583 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,7 @@ For Debian/Ubuntu based Linux: sudo apt install xz-utils \ python3 ca-certificates git \ pkg-config libglib2.0-dev \ - gperf libexpat1-dev \ + gperf libexpat1-dev unzip \ cmake clang ``` From 8d3a3787611b610f77f47d7acbe15ed86acbea31 Mon Sep 17 00:00:00 2001 From: Karl Seguin Date: Thu, 8 May 2025 21:14:33 +0800 Subject: [PATCH 04/10] remove unused import, add debug statement --- build.zig | 1 - src/runtime/test_object_types.zig | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build.zig b/build.zig index 8f38170c7..9e1809937 100644 --- a/build.zig +++ b/build.zig @@ -165,7 +165,6 @@ fn common(b: *std.Build, opts: *std.Build.Step.Options, step: *std.Build.Step.Co ); mod.link_libcpp = true; mod.addObjectFile(mod.owner.path(lib_path)); - mod.addIncludePath(b.path("src/runtime/v8")); switch (target.result.os.tag) { .macos => { diff --git a/src/runtime/test_object_types.zig b/src/runtime/test_object_types.zig index b3594dc01..fd91f6316 100644 --- a/src/runtime/test_object_types.zig +++ b/src/runtime/test_object_types.zig @@ -97,6 +97,8 @@ test "JS: object types" { // v8 has 5 default "own" properties const own_base = "5"; + std.debug.print("MASKING: {d} {d}\n", .{@import("v8").PropertyHandlerFlags.OnlyInterceptStrings, @import("v8").PropertyHandlerFlags.NonMasking}); + try runner.testCases(&.{ .{ "Object.getOwnPropertyNames(MyObject).length;", own_base }, .{ "let myObj = new MyObject(true);", "undefined" }, From 37467d3753c23d1cf9e04093fbbbce979859b46e Mon Sep 17 00:00:00 2001 From: Karl Seguin Date: Thu, 8 May 2025 23:06:46 +0800 Subject: [PATCH 05/10] remove debug statement --- src/runtime/test_object_types.zig | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/runtime/test_object_types.zig b/src/runtime/test_object_types.zig index fd91f6316..b3594dc01 100644 --- a/src/runtime/test_object_types.zig +++ b/src/runtime/test_object_types.zig @@ -97,8 +97,6 @@ test "JS: object types" { // v8 has 5 default "own" properties const own_base = "5"; - std.debug.print("MASKING: {d} {d}\n", .{@import("v8").PropertyHandlerFlags.OnlyInterceptStrings, @import("v8").PropertyHandlerFlags.NonMasking}); - try runner.testCases(&.{ .{ "Object.getOwnPropertyNames(MyObject).length;", own_base }, .{ "let myObj = new MyObject(true);", "undefined" }, From 23b39c6a63272556801aa2bd8d3d69f1fa21748b Mon Sep 17 00:00:00 2001 From: Karl Seguin Date: Fri, 9 May 2025 14:48:34 +0800 Subject: [PATCH 06/10] return explicit intercept state from named/indexed getters --- src/runtime/js.zig | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/runtime/js.zig b/src/runtime/js.zig index e5548d289..c1ebb0b08 100644 --- a/src/runtime/js.zig +++ b/src/runtime/js.zig @@ -1352,14 +1352,15 @@ pub fn Env(comptime State: type, comptime WebApis: type) type { } const configuration = v8.IndexedPropertyHandlerConfiguration{ .getter = struct { - fn callback(idx: u32, raw_info: ?*const v8.C_PropertyCallbackInfo) callconv(.c) void { + fn callback(idx: u32, raw_info: ?*const v8.C_PropertyCallbackInfo) callconv(.c) u8 { const info = v8.PropertyCallbackInfo.initFromV8(raw_info); var caller = Caller(Self, State).init(info); defer caller.deinit(); const named_function = comptime NamedFunction.init(Struct, "indexed_get"); - caller.getIndex(Struct, named_function, idx, info) catch |err| { + return caller.getIndex(Struct, named_function, idx, info) catch |err| blk: { caller.handleError(Struct, named_function, err, info); + break :blk v8.Intercepted.No; }; } }.callback, @@ -1381,14 +1382,15 @@ pub fn Env(comptime State: type, comptime WebApis: type) type { } const configuration = v8.NamedPropertyHandlerConfiguration{ .getter = struct { - fn callback(c_name: ?*const v8.C_Name, raw_info: ?*const v8.C_PropertyCallbackInfo) callconv(.c) void { + fn callback(c_name: ?*const v8.C_Name, raw_info: ?*const v8.C_PropertyCallbackInfo) callconv(.c) u8 { const info = v8.PropertyCallbackInfo.initFromV8(raw_info); var caller = Caller(Self, State).init(info); defer caller.deinit(); const named_function = comptime NamedFunction.init(Struct, "named_get"); - caller.getNamedIndex(Struct, named_function, .{ .handle = c_name.? }, info) catch |err| { + return caller.getNamedIndex(Struct, named_function, .{ .handle = c_name.? }, info) catch |err| blk: { caller.handleError(Struct, named_function, err, info); + break :blk v8.Intercepted.No; }; } }.callback, @@ -1822,7 +1824,7 @@ fn Caller(comptime E: type, comptime State: type) type { _ = @call(.auto, func, args); } - fn getIndex(self: *Self, comptime Struct: type, comptime named_function: NamedFunction, idx: u32, info: v8.PropertyCallbackInfo) !void { + fn getIndex(self: *Self, comptime Struct: type, comptime named_function: NamedFunction, idx: u32, info: v8.PropertyCallbackInfo) !u8 { const func = @field(Struct, named_function.name); const IndexedGet = @TypeOf(func); if (@typeInfo(IndexedGet).@"fn".return_type == null) { @@ -1851,15 +1853,13 @@ fn Caller(comptime E: type, comptime State: type) type { const res = @call(.auto, func, args); if (has_value == false) { - // for an indexed parameter, say nodes[10000], we should return - // undefined, not null, if the index is out of rante - info.getReturnValue().set(try self.zigValueToJs({})); - } else { - info.getReturnValue().set(try self.zigValueToJs(res)); + return v8.Intercepted.No; } + info.getReturnValue().set(try self.zigValueToJs(res)); + return v8.Intercepted.Yes; } - fn getNamedIndex(self: *Self, comptime Struct: type, comptime named_function: NamedFunction, name: v8.Name, info: v8.PropertyCallbackInfo) !void { + fn getNamedIndex(self: *Self, comptime Struct: type, comptime named_function: NamedFunction, name: v8.Name, info: v8.PropertyCallbackInfo) !u8 { const func = @field(Struct, named_function.name); const NamedGet = @TypeOf(func); if (@typeInfo(NamedGet).@"fn".return_type == null) { @@ -1887,12 +1887,10 @@ fn Caller(comptime E: type, comptime State: type) type { const res = @call(.auto, func, args); if (has_value == false) { - // for an indexed parameter, say nodes[10000], we should return - // undefined, not null, if the index is out of rante - info.getReturnValue().set(try self.zigValueToJs({})); - } else { - info.getReturnValue().set(try self.zigValueToJs(res)); + return v8.Intercepted.No; } + info.getReturnValue().set(try self.zigValueToJs(res)); + return v8.Intercepted.Yes; } fn nameToString(self: *Self, name: v8.Name) ![]const u8 { From a729a6110085da1621127526e338830c9dad1455 Mon Sep 17 00:00:00 2001 From: Karl Seguin Date: Fri, 9 May 2025 20:07:14 +0800 Subject: [PATCH 07/10] zig fmt build.zig --- build.zig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.zig b/build.zig index 9e1809937..97cf4c067 100644 --- a/build.zig +++ b/build.zig @@ -161,7 +161,7 @@ fn common(b: *std.Build, opts: *std.Build.Step.Options, step: *std.Build.Step.Co const lib_path = try std.fmt.allocPrint( mod.owner.allocator, "v8/out/{s}/obj/zig/libc_v8.a", - .{ if (mod.optimize.? == .Debug) "debug" else "release" }, + .{if (mod.optimize.? == .Debug) "debug" else "release"}, ); mod.link_libcpp = true; mod.addObjectFile(mod.owner.path(lib_path)); @@ -177,7 +177,6 @@ fn common(b: *std.Build, opts: *std.Build.Step.Options, step: *std.Build.Step.Co mod.addImport("build_info", opts.createModule()); mod.addObjectFile(mod.owner.path(lib_path)); - } fn moduleNetSurf(b: *std.Build, step: *std.Build.Step.Compile, target: std.Build.ResolvedTarget) !void { From 66638cab3391b790755ffc7ab7a654627f89c21d Mon Sep 17 00:00:00 2001 From: Karl Seguin Date: Wed, 14 May 2025 15:02:55 +0800 Subject: [PATCH 08/10] update v8 revision --- .github/actions/install/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index 879ca597d..0229bbd8b 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -21,7 +21,7 @@ inputs: v8: description: 'v8 version to install' required: false - default: '11.1.134' + default: '13.6.233.8' cache-dir: description: 'cache dir to use' required: false From aaa34ab860fc6a69182b3406eb9d3ec9ca258825 Mon Sep 17 00:00:00 2001 From: Karl Seguin Date: Wed, 14 May 2025 15:19:47 +0800 Subject: [PATCH 09/10] link libc_v8.a in correct directory --- .github/actions/install/action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index 0229bbd8b..69ed6a91f 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -59,11 +59,11 @@ runs: - name: install v8 shell: bash run: | - mkdir -p v8/build/${{inputs.arch}}-${{inputs.os}}/debug/ninja/obj/zig/ - ln -s ${{ inputs.cache-dir }}/v8/libc_v8.a v8/build/${{inputs.arch}}-${{inputs.os}}/debug/ninja/obj/zig/libc_v8.a + mkdir -p v8/out/debug/obj/zig/ + ln -s ${{ inputs.cache-dir }}/v8/libc_v8.a v8/out/debug/obj/zig/libc_v8.a - mkdir -p v8/build/${{inputs.arch}}-${{inputs.os}}/release/ninja/obj/zig/ - ln -s ${{ inputs.cache-dir }}/v8/libc_v8.a v8/build/${{inputs.arch}}-${{inputs.os}}/release/ninja/obj/zig/libc_v8.a + mkdir -p v8/out/release/obj/zig/ + ln -s ${{ inputs.cache-dir }}/v8/libc_v8.a v8/out/release/obj/zig/libc_v8.a - name: libiconv shell: bash From b559506d4e540eb3672d4cfbe6093a0fbeae4168 Mon Sep 17 00:00:00 2001 From: Karl Seguin Date: Fri, 16 May 2025 08:10:16 +0800 Subject: [PATCH 10/10] remove unecessary space --- build.zig.zon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.zig.zon b/build.zig.zon index e507a753c..1e8805b57 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -16,7 +16,7 @@ .url = "https://github.com/lightpanda-io/zig-v8-fork/archive/4809111f930293c6d5082971ad7ffc3d822b6f37.tar.gz", .hash = "v8-0.0.0-xddH632xAwAjF7ieh48tjbMpu7fVVGr3r3aLwmBbFvPk", }, - // .v8 = .{ .path = "../zig-v8-fork" }, + //.v8 = .{ .path = "../zig-v8-fork" }, //.tigerbeetle_io = .{ .path = "../tigerbeetle-io" }, }, }