Files
ladybird/Tests/LibJS/Bytecode/expected/destructuring-assignment.txt
Andreas Kling ec2f4e4a7b 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.
2026-02-11 23:57:41 +01:00

71 lines
3.8 KiB
Plaintext

JS bytecode executable ""
[ 0] 0: GetLexicalEnvironment dst:reg4
[ 8] GetGlobal dst:reg6, identifier:array_destructuring_with_class_default
[ 18] Call dst:reg5, callee:reg6, this_value:Undefined, array_destructuring_with_class_default
[ 38] GetGlobal dst:reg7, identifier:object_destructuring_with_function_default
[ 48] Call dst:reg6, callee:reg7, this_value:Undefined, object_destructuring_with_function_default
[ 68] GetGlobal dst:reg7, identifier:setter_parameter_resolution
[ 78] Call dst:reg5, callee:reg7, this_value:Undefined, setter_parameter_resolution
[ 98] End value:reg5
JS bytecode executable "array_destructuring_with_class_default"
[ 0] 0: GetLexicalEnvironment dst:reg4
[ 8] Mov dst:x~0, src:Undefined
[ 18] NewArray dst:reg5, elements:[Undefined]
[ 30] Mov dst:reg6, src:Bool(false)
[ 40] GetIterator dst_iterator_object:reg7, dst_iterator_next:reg8, dst_iterator_done:reg9, iterable:reg5
[ 58] IteratorNextUnpack dst_value:reg11, dst_done:reg6, iterator_object:reg7, iterator_next:reg8, iterator_done:reg9
[ 70] JumpFalse condition:reg6, target:@98
[ 80] 1: Mov dst:reg11, src:Undefined
[ 90] Jump target:@98
[ 98] 2: JumpUndefined condition:reg11, true_target:@a8, false_target:@100
[ a8] 3: CreateLexicalEnvironment dst:reg12, parent:reg4, capacity:0
[ b8] CreateVariable identifier:C, is_immutable:true, is_global:false, is_strict:false
[ c8] SetLexicalEnvironment environment:reg4
[ d0] NewClass dst:reg13, class_environment:reg12, class_blueprint_index:0
[ f0] Mov dst:reg11, src:reg13
[ 100] 4: Mov dst:x~0, src:reg11
[ 110] JumpFalse condition:reg6, target:@128
[ 120] 5: Return value:x~0
[ 128] 6: IteratorClose iterator_object:reg7, iterator_next:reg8, iterator_done:reg9
[ 148] Return value:x~0
JS bytecode executable "object_destructuring_with_function_default"
[ 0] 0: GetLexicalEnvironment dst:reg4
[ 8] Mov dst:x~0, src:Undefined
[ 18] NewObject dst:reg5
[ 28] ThrowIfNullish src:reg5
[ 30] GetById dst:reg6, base:reg5, property:x
[ 48] JumpUndefined condition:reg6, true_target:@58, false_target:@80
[ 58] 1: NewFunction dst:reg7, shared_function_data_index:0, lhs_name:x
[ 70] Mov dst:reg6, src:reg7
[ 80] 2: Mov dst:x~0, src:reg6
[ 90] Return value:x~0
JS bytecode executable "setter_parameter_resolution"
[ 0] 0: GetLexicalEnvironment dst:reg4
[ 8] CreateVariable identifier:setValue, is_immutable:false, is_global:false, is_strict:false
[ 18] InitializeVariableBinding identifier:setValue, src:Undefined
[ 30] NewPrimitiveArray dst:reg5, elements:[23]
[ 48] Mov dst:reg6, src:Bool(false)
[ 58] GetIterator dst_iterator_object:reg7, dst_iterator_next:reg8, dst_iterator_done:reg9, iterable:reg5
[ 70] IteratorNextUnpack dst_value:reg11, dst_done:reg6, iterator_object:reg7, iterator_next:reg8, iterator_done:reg9
[ 88] JumpFalse condition:reg6, target:@b0
[ 98] 1: Mov dst:reg11, src:Undefined
[ a8] Jump target:@b0
[ b0] 2: NewObject dst:reg12
[ c0] NewFunction dst:reg13, shared_function_data_index:0, lhs_name:set y, home_object:reg12
[ d8] PutSetterById base:reg12, property:y, src:reg13
[ f0] PutNormalById base:reg12, property:y, src:reg11
[ 108] JumpFalse condition:reg6, target:@138
[ 118] 3: GetInitializedBinding dst:reg5, identifier:setValue
[ 130] Return value:reg5
[ 138] 4: IteratorClose iterator_object:reg7, iterator_next:reg8, iterator_done:reg9
[ 158] Jump target:@118
JS bytecode executable "set y"
[ 0] 0: GetLexicalEnvironment dst:reg4
[ 8] SetLexicalBinding identifier:setValue, src:arg0
[ 20] End value:Undefined