Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor JS parser visitor step into individual functions to reduce stack space usage #15993

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bundler/bundle_v2.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6978,7 +6978,7 @@ pub const LinkerContext = struct {
}

const expr = Expr{
.data = stmt.data.s_lazy_export,
.data = stmt.data.s_lazy_export.*,
.loc = stmt.loc,
};
const module_ref = this.graph.ast.items(.module_ref)[source_index];
Expand Down
12 changes: 9 additions & 3 deletions src/js_ast.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3044,7 +3044,7 @@ pub const Stmt = struct {
return Stmt.allocate(allocator, S.SExpr, S.SExpr{ .value = expr }, expr.loc);
}

pub const Tag = enum(u6) {
pub const Tag = enum {
s_block,
s_break,
s_class,
Expand Down Expand Up @@ -3126,7 +3126,13 @@ pub const Stmt = struct {
s_empty: S.Empty, // special case, its a zero value type
s_debugger: S.Debugger,

s_lazy_export: Expr.Data,
s_lazy_export: *Expr.Data,

comptime {
if (@sizeOf(Stmt) > 24) {
@compileLog("Expected Stmt to be <= 24 bytes, but it is", @sizeOf(Stmt), " bytes");
}
}

pub const Store = struct {
const StoreType = NewStore(&.{
Expand Down Expand Up @@ -4564,7 +4570,7 @@ pub const Expr = struct {
};
}

pub const Tag = enum(u6) {
pub const Tag = enum {
e_array,
e_unary,
e_binary,
Expand Down
Loading
Loading