mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-16 08:18:59 +00:00
Fix dockerfile (hopefully)
Add dummy --json stats output to tests Comment typos fixed Add make get-v8, build-v8 and build-v8-dev make targets
This commit is contained in:
@@ -129,7 +129,6 @@ pub fn Env(comptime S: type, comptime types: anytype) type {
|
||||
var prototype_index = i;
|
||||
const Struct = @field(types, s.name);
|
||||
if (@hasDecl(Struct, "prototype")) {
|
||||
prototype_index = 1;
|
||||
const TI = @typeInfo(Struct.prototype);
|
||||
const proto_name = @typeName(Receiver(TI.pointer.child));
|
||||
prototype_index = @field(TYPE_LOOKUP, proto_name);
|
||||
@@ -776,8 +775,8 @@ pub fn Env(comptime S: type, comptime types: anytype) type {
|
||||
scope_arena: ArenaAllocator,
|
||||
|
||||
// When we need to load a resource (i.e. an external script), we call
|
||||
// this function to get the source. This is always a refernece to the
|
||||
// Browser Session's fetchModuleSource, but we use a funciton pointer
|
||||
// this function to get the source. This is always a reference to the
|
||||
// Browser Session's fetchModuleSource, but we use a function pointer
|
||||
// since this js module is decoupled from the browser implementation.
|
||||
module_loader: ModuleLoader,
|
||||
|
||||
@@ -931,7 +930,7 @@ pub fn Env(comptime S: type, comptime types: anytype) type {
|
||||
|
||||
// To turn a Zig instance into a v8 object, we need to do a number of things.
|
||||
// First, if it's a struct, we need to put it on the heap
|
||||
// Second, if we've alrady returned this instance, we should return
|
||||
// Second, if we've already returned this instance, we should return
|
||||
// the same object. Hence, our executor maintains a map of Zig objects
|
||||
// to v8.PersistentObject (the "identity_map").
|
||||
// Finally, if this is the first time we've seen this instance, we need to:
|
||||
|
||||
@@ -46,6 +46,19 @@ pub fn main() !void {
|
||||
var slowest = SlowTracker.init(allocator, 5);
|
||||
defer slowest.deinit();
|
||||
|
||||
var args = try std.process.argsWithAllocator(allocator);
|
||||
defer args.deinit();
|
||||
|
||||
// ignore the exec name.
|
||||
_ = args.next();
|
||||
var json_stats = false;
|
||||
while (args.next()) |arg| {
|
||||
if (std.mem.eql(u8, "--json", arg)) {
|
||||
json_stats = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
var pass: usize = 0;
|
||||
var fail: usize = 0;
|
||||
var skip: usize = 0;
|
||||
@@ -155,6 +168,37 @@ pub fn main() !void {
|
||||
printer.fmt("\n", .{});
|
||||
try slowest.display(printer);
|
||||
printer.fmt("\n", .{});
|
||||
|
||||
// TODO: at the very least, `browser` should return real stats
|
||||
if (json_stats) {
|
||||
try std.json.stringify(&.{
|
||||
.{ .name = "browser", .bench = .{
|
||||
.duration = 3180096049,
|
||||
.alloc_nb = 6,
|
||||
.realloc_nb = 278,
|
||||
.alloc_size = 24711226,
|
||||
} },
|
||||
.{ .name = "libdom", .bench = .{
|
||||
.duration = 3180096049,
|
||||
.alloc_nb = 0,
|
||||
.realloc_nb = 0,
|
||||
.alloc_size = 0,
|
||||
} },
|
||||
.{ .name = "v8", .bench = .{
|
||||
.duration = 3180096049,
|
||||
.alloc_nb = 0,
|
||||
.realloc_nb = 0,
|
||||
.alloc_size = 0,
|
||||
} },
|
||||
.{ .name = "main", .bench = .{
|
||||
.duration = 3180096049,
|
||||
.alloc_nb = 0,
|
||||
.realloc_nb = 0,
|
||||
.alloc_size = 0,
|
||||
} },
|
||||
}, .{ .whitespace = .indent_2 }, std.io.getStdOut().writer());
|
||||
}
|
||||
|
||||
std.posix.exit(if (fail == 0) 0 else 1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user