Files
ladybird/Tests/LibJS/Bytecode/expected/computed-member-access.txt
Andreas Kling 49f2f1e7cd LibJS: Skip unnecessary Mov in emit_load_from_reference for reads
When MemberExpression::generate_bytecode calls emit_load_from_reference,
it only uses the loaded_value and discards the reference operands. For
computed member expressions (e.g. a[0]), this was generating an
unnecessary Mov to save the property register for potential store-back.

Add a ReferenceMode parameter to emit_load_from_reference. When LoadOnly
is passed, the computed property path skips the register save and Mov.
2026-02-15 23:21:46 +01:00

20 lines
945 B
Plaintext

JS bytecode executable ""
[ 0] 0: GetLexicalEnvironment dst:reg4
[ 8] GetGlobal dst:reg6, identifier:computed_read
[ 18] NewPrimitiveArray dst:reg7, elements:[1]
[ 30] Call dst:reg5, callee:reg6, this_value:Undefined, computed_read, arguments:[reg7]
[ 58] GetGlobal dst:reg7, identifier:computed_read_expression
[ 68] NewPrimitiveArray dst:reg8, elements:[1]
[ 80] Call dst:reg6, callee:reg7, this_value:Undefined, computed_read_expression, arguments:[reg8, Int32(0)]
[ a8] End value:reg6
JS bytecode executable "computed_read"
[ 0] 0: GetLexicalEnvironment dst:reg4
[ 8] GetByValue dst:reg5, base:arg0, property:Int32(0), base_identifier:a
[ 20] Return value:reg5
JS bytecode executable "computed_read_expression"
[ 0] 0: GetLexicalEnvironment dst:reg4
[ 8] GetByValue dst:reg5, base:arg0, property:arg1, base_identifier:a
[ 20] Return value:reg5