mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-18 18:00:31 +00:00
LibJS: Wire NewClass to ClassBlueprint
Replace the ClassExpression const& reference in the NewClass instruction with a u32 class_blueprint_index. The interpreter now reads from the ClassBlueprint stored on the Executable and calls construct_class() instead of the AST-based create_class_constructor(). Literal field initializers (numbers, booleans, null, strings, negated numbers) are used directly in construct_class() without creating an ECMAScriptFunctionObject, avoiding function creation overhead for common field patterns like `x = 0` or `name = "hello"`. Set class_field_initializer_name on SharedFunctionInstanceData at codegen time for statically-known field keys (identifiers, private identifiers, string literals, and numeric literals). For computed keys, the name is set at runtime in construct_class(). ClassExpression AST nodes are no longer referenced from bytecode.
This commit is contained in:
parent
fa6a3f31dc
commit
ec2f4e4a7b
Notes:
github-actions[bot]
2026-02-11 23:01:20 +00:00
Author: https://github.com/awesomekling
Commit: ec2f4e4a7b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7896
10 changed files with 157 additions and 38 deletions
|
|
@ -100,6 +100,12 @@ void Executable::visit_edges(Visitor& visitor)
|
|||
visitor.visit(cache.cached_template_object);
|
||||
for (auto& data : shared_function_data)
|
||||
visitor.visit(data);
|
||||
for (auto& blueprint : class_blueprints) {
|
||||
for (auto& element : blueprint.elements) {
|
||||
if (element.literal_value.has_value() && element.literal_value->is_cell())
|
||||
visitor.visit(element.literal_value->as_cell());
|
||||
}
|
||||
}
|
||||
property_key_table->visit_edges(visitor);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue