mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
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.
14 lines
194 B
JavaScript
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();
|