mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:27:34 +00:00
LibJS: Use MarkedValueList for internal own properties getter functions
Letting these create and return a JS::Array directly is pretty awkward since we then need to go through the indexed properties for iteration. Just use a MarkedValueList (i.e. Vector<Value>) for this and add a new Array::create_from() function to turn the Vector into a returnable Array as we did before. This brings it a lot closer to the spec as well, which uses the CreateArrayFromList abstract operation to do exactly this. There's an optimization opportunity for the future here, since we know the Vector's size we could prepare the newly created Array accordingly, e.g. by switching to generic storage upfront if needed.
This commit is contained in:
parent
a42886d8ff
commit
1c3eef5317
7 changed files with 37 additions and 31 deletions
|
@ -97,8 +97,8 @@ public:
|
|||
virtual bool put(const PropertyName&, Value, Value receiver = {});
|
||||
|
||||
Value get_own_property(const PropertyName&, Value receiver) const;
|
||||
Value get_own_properties(PropertyKind, bool only_enumerable_properties = false, GetOwnPropertyReturnType = GetOwnPropertyReturnType::All) const;
|
||||
Value get_enumerable_own_property_names(PropertyKind) const;
|
||||
MarkedValueList get_own_properties(PropertyKind, bool only_enumerable_properties = false, GetOwnPropertyReturnType = GetOwnPropertyReturnType::All) const;
|
||||
MarkedValueList get_enumerable_own_property_names(PropertyKind) const;
|
||||
virtual Optional<PropertyDescriptor> get_own_property_descriptor(const PropertyName&) const;
|
||||
Value get_own_property_descriptor_object(const PropertyName&) const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue