Closed Bug 1705665 Opened 2 years ago Closed 2 years ago

Add an iterator class for iterating over a shape's properties


(Core :: JavaScript Engine, task, P2)




89 Branch
Tracking Status
firefox89 --- fixed


(Reporter: jandem, Assigned: jandem)




(5 files)

We can convert most uses of Shape::Range to a more modern C++ iterator that doesn't expose the property's shape. Similar to the changes in bug 1704744, this decouples properties from shapes.

This was probably needed for ExclusiveContext back then.

The iterator is based on Shape::Range, but is a bit more ergonomic and doesn't expose
the property's Shape. This means when we change the shape's property representation
later on we only have to change the iterator implementation.

Also start using shape() instead of lastProperty() because lastProperty will
either be removed or changed in the future, to decouple shapes and properties more.

The code generated by Clang for some of these functions looks good: the compiler
is able to optimize away the iterator and ShapePropertyWithKey code.

Depends on D112328

These uses are a bit more complicated because they collect the properties in a Vector.

Depends on D112329

This probably became dead code when shapes started implying a realm.

Depends on D112331

Pushed by
part 1 - Remove CX template parameter from FakeRooted constructors. r=jonco
part 2 - Add ShapePropertyIter and start using it. r=jonco
part 3 - Use ShapePropertyIter in more places. r=jonco
part 4 - Use ShapePropertyIter instead of manually walking over the shape list in a few places. r=jonco
part 5 - Remove dead code in AddLengthProperty. r=jonco
You need to log in before you can comment on or make changes to this bug.