Files
ladybird/Tests/LibJS/Bytecode/input/super-length-access.js
Andreas Kling d0b9905de1 LibJS/Rust: Use GetLengthWithThis for super.length property access
The C++ pipeline has an optimization that uses the GetLengthWithThis
instruction instead of GetByIdWithThis when accessing the "length"
property. Add the same optimization to the Rust pipeline by
introducing an emit_get_by_id_with_this helper that checks for the
"length" property name and emits the optimized instruction.

Also update emit_get_by_value_with_this to use GetLengthWithThis
when the computed property is a constant "length" string.
2026-03-01 21:20:54 +01:00

14 lines
194 B
JavaScript

// Test that super.length uses the GetLengthWithThis optimization.
class A {
get length() { return 42; }
}
class B extends A {
m() {
return super.length;
}
}
new B().m();