Fix build

Update zig-v8-fork dependency

Optimize string.repeat

Provide arraybuffer allocation max size (pre-merging https://github.com/lightpanda-io/browser/pull/3751
since the zig-v8-fork now needs it).
This commit is contained in:
Karl Seguin committed 2026-10-05 11:33:42 +08:00
1 parent 01a703f7e2
commit f4544da758
8 files changed
+18 -16

No files matched your search

+1 -1
View File
@@ -13,7 +13,7 @@ inputs:
zig-v8:
description: 'zig v8 version to install'
required: false
default: 'v0.5.8'
default: 'v0.5.9'
v8:
description: 'v8 version to install'
required: false
+1 -1
View File
@@ -13,7 +13,7 @@ inputs:
zig-v8:
description: 'zig-v8 release tag the prebuilt lib came from'
required: false
default: 'v0.5.8'
default: 'v0.5.9'
runs:
using: "composite"
+1 -1
View File
@@ -4,7 +4,7 @@ FROM debian:stable-slim
ARG MINISIG=0.12
ARG ZIG_MINISIG=RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U
ARG V8=15.5.35.13
ARG ZIG_V8=v0.5.8
ARG ZIG_V8=v0.5.9
ARG TARGETPLATFORM
RUN apt-get update -yq && \
+3 -1
View File
@@ -306,11 +306,13 @@ fn findPrebuiltV8(b: *Build, target: Build.ResolvedTarget, dev_fast: bool) ?[]co
@tagName(target.result.cpu.arch),
}) });
};
b.dependOnFileMetadata(b.path(path));
std.Io.Dir.cwd().access(io, rootPath(b, path), .{}) catch {
// Zig can't track a missing file as a configure dependency; the
// source-build path poisons the configure cache instead.
std.debug.print("No prebuilt V8 at {s}; using the V8 source-build path. `make download-v8` fetches the prebuilt.\n", .{path});
return null;
};
b.dependOnFileMetadata(b.path(path));
std.debug.print("Using prebuilt V8: {s}\n", .{path});
return path;
}
+2 -2
View File
@@ -5,8 +5,8 @@
.minimum_zig_version = "0.17.0",
.dependencies = .{
.v8 = .{
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/10f6a11e81fd4809988a24e3f5b3d5d4fd3a73fe.tar.gz",
.hash = "v8-0.0.0-xddH6w1QAwDcuJPtc73VXElNBsgPgrRBqQR__jWhy_C4",
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/b73e4fa2d0afe5036745ae7d332cc5cb7e7adb53.tar.gz",
.hash = "v8-0.0.0-xddH64tVAwDZKW4zyy2h9cKXeWfWSjupsZIwTbYxSL9T",
},
// .v8 = .{ .path = "../zig-v8-fork" },
.brotli = .{
+1 -1
View File
@@ -153,7 +153,7 @@ pub fn init(app: *App, opts: InitOpts) !Env {
v8.v8__Isolate__CreateParams__CONSTRUCT(params);
params.snapshot_blob = @ptrCast(&snapshot.startup_data);
params.array_buffer_allocator = v8.v8__ArrayBuffer__Allocator__NewDefaultAllocator().?;
params.array_buffer_allocator = v8.v8__ArrayBuffer__Allocator__NewDefaultAllocator(4 * 1024 * 1024 * 1024).?;
errdefer v8.v8__ArrayBuffer__Allocator__DELETE(params.array_buffer_allocator.?);
params.external_references = &snapshot.external_references;
+1 -1
View File
@@ -142,7 +142,7 @@ pub fn create() !Snapshot {
var params: v8.CreateParams = undefined;
v8.v8__Isolate__CreateParams__CONSTRUCT(&params);
params.array_buffer_allocator = v8.v8__ArrayBuffer__Allocator__NewDefaultAllocator();
params.array_buffer_allocator = v8.v8__ArrayBuffer__Allocator__NewDefaultAllocator(4 * 1024 * 1024 * 1024);
defer v8.v8__ArrayBuffer__Allocator__DELETE(params.array_buffer_allocator.?);
params.external_references = @ptrCast(&external_references);
+8 -8
View File
@@ -545,15 +545,15 @@ pub fn repeat(comptime s: []const u8, comptime n: usize) *const [s.len * n:0]u8
fn Repeated(comptime s: []const u8, comptime n: usize) type {
return struct {
const value: [s.len * n:0]u8 = blk: {
var buf: [s.len * n:0]u8 = undefined;
if (s.len == 1) {
buf = @splat(s[0]);
} else {
@setEvalBranchQuota(1000 + 10 * n);
for (0..n) |i| @memcpy(buf[i * s.len ..][0..s.len], s);
// Doubling: log2(n) concatenations instead of n comptime memcpys.
var acc: []const u8 = "";
var pow: []const u8 = s;
var k = n;
while (k > 0) : (k >>= 1) {
if (k & 1 == 1) acc = acc ++ pow;
if (k > 1) pow = pow ++ pow;
}
buf[buf.len] = 0;
break :blk buf;
break :blk acc[0 .. s.len * n].* ++ [_:0]u8{};
};
};
}