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:
Andreas Kling
2026-02-11 00:28:10 +01:00
committed by Andreas Kling
parent fa6a3f31dc
commit ec2f4e4a7b
Notes: github-actions[bot] 2026-02-11 23:01:20 +00:00
10 changed files with 157 additions and 38 deletions

View File

@@ -669,7 +669,7 @@ op NewClass < Instruction
m_dst: Operand
m_super_class: Optional<Operand>
m_class_environment: Operand
m_class_expression: ClassExpression const&
m_class_blueprint_index: u32
m_lhs_name: Optional<IdentifierTableIndex>
m_element_keys_count: u32
m_element_keys: Optional<Operand>[]