ladybird/Libraries/LibJS/Bytecode
Aliaksandr Kalenik 451c947c3f LibJS: Fast-path own-property enumeration and reduce descriptor lookups
Before this change, PropertyNameIterator (used by for..in) and
`Object::enumerable_own_property_names()` (used by `Object.keys()`,
`Object.values()`, and `Object.entries()`) enumerated an object's own
enumerable properties exactly as the spec prescribes:
- Call `internal_own_property_keys()`, allocating a list of JS::Value
  keys.
- For each key, call internal_get_own_property() to obtain a
  descriptor and check `[[Enumerable]]`.

While that is required in the general case (e.g. for Proxy objects or
platform/exotic objects that override `[[OwnPropertyKeys]]`), it's
overkill for ordinary JS objects that store their own properties in the
shape table and indexed-properties storage.

This change introduces `for_each_own_property_with_enumerability()`,
which, for objects where
`eligible_for_own_property_enumeration_fast_path()` is `true`, lets us
read the enumerability directly from shape metadata (and from
indexed-properties storage) without a per-property descriptor lookup.
When we cannot avoid `internal_get_own_property()`, we still
benefit by skipping the temporary `Vector<Value>` of keys and avoiding
the unnecessary round-trip between PropertyKey and Value.
2025-09-21 15:06:32 +02:00
..
ASTCodegen.cpp LibJS: Add PutByNumericId and change PutById to be string key only 2025-09-13 20:02:28 +02:00
BasicBlock.cpp
BasicBlock.h Everywhere: Slap some [[clang::lifetimebound]] where appropriate 2025-09-01 11:11:38 +02:00
Builtins.cpp
Builtins.h LibJS: Do more comprehensive check if next() fast path is possible 2025-06-02 00:15:36 +02:00
CodeGenerationError.cpp
CodeGenerationError.h LibJS: Revert Enable EXPLICIT_SYMBOL_EXPORT 2025-07-22 11:51:29 -04:00
Executable.cpp LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
Executable.h LibJS: Add inline caching for adding new own properties to objects 2025-09-17 12:44:44 +02:00
Generator.cpp LibJS: Add PutByNumericId and change PutById to be string key only 2025-09-13 20:02:28 +02:00
Generator.h LibJS: Add PutByNumericId and change PutById to be string key only 2025-09-13 20:02:28 +02:00
IdentifierTable.cpp LibJS+LibWeb+WebContent: Port JS::PropertyKey to UTF-16 2025-08-05 07:07:15 -04:00
IdentifierTable.h LibJS+LibWeb+WebContent: Port JS::PropertyKey to UTF-16 2025-08-05 07:07:15 -04:00
Instruction.cpp LibJS: Remove unused InstructionStreamIterator::source_code getter 2025-04-16 10:41:44 -06:00
Instruction.h LibJS: Add PutByNumericId and change PutById to be string key only 2025-09-13 20:02:28 +02:00
Interpreter.cpp LibJS: Fast-path own-property enumeration and reduce descriptor lookups 2025-09-21 15:06:32 +02:00
Interpreter.h LibJS: Allocate context up front in SuperCallWithArgumentArray 2025-08-31 15:24:37 +02:00
Label.cpp
Label.h LibJS: Revert Enable EXPLICIT_SYMBOL_EXPORT 2025-07-22 11:51:29 -04:00
Op.h LibJS: Add PutByNumericId and change PutById to be string key only 2025-09-13 20:02:28 +02:00
Operand.h LibJS: Revert Enable EXPLICIT_SYMBOL_EXPORT 2025-07-22 11:51:29 -04:00
RegexTable.cpp
RegexTable.h LibJS: Revert Enable EXPLICIT_SYMBOL_EXPORT 2025-07-22 11:51:29 -04:00
Register.h LibJS: Revert Enable EXPLICIT_SYMBOL_EXPORT 2025-07-22 11:51:29 -04:00
ScopedOperand.cpp
ScopedOperand.h LibJS: Revert Enable EXPLICIT_SYMBOL_EXPORT 2025-07-22 11:51:29 -04:00
StringTable.cpp LibJS+LibWeb: Port interned bytecode strings to UTF-16 2025-08-14 10:27:08 +02:00
StringTable.h LibJS+LibWeb: Port interned bytecode strings to UTF-16 2025-08-14 10:27:08 +02:00