mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
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.
14 lines
308 B
JavaScript
14 lines
308 B
JavaScript
// Test that computed member reads don't generate an unnecessary Mov
|
|
// to save the property register (only needed for store-back operations).
|
|
|
|
function computed_read(a) {
|
|
return a[0];
|
|
}
|
|
|
|
function computed_read_expression(a, i) {
|
|
return a[i];
|
|
}
|
|
|
|
computed_read([1]);
|
|
computed_read_expression([1], 0);
|