Closed Bug 1707562 Opened 4 years ago Closed 4 years ago

Fix maybeDensifySparseElements to not reshape for each element

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

RESOLVED FIXED
90 Branch
Tracking Status
firefox90 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

Details

Attachments

(8 files)

In NativeObject::maybeDensifySparseElements, we remove each sparse-element property one by one. Because the object is in dictionary mode, this will result in a new shape being allocated for each property we remove. This is slow and adds unnecessary GC pressure; we can change this to allocate just a single new shape.

Densification is rare; most websites don't hit this code at all. However it's easy to fix and this refactoring will also make it easier to change this code for the ReShape work.

After the previous patch this is only called for dictionary objects.

The caller already has the ShapeTable it can pass in.

Depends on D113348

This is just moving code, no other changes.

Depends on D113349

Densify all properties and then assign a new shape to the object, instead of
allocating a new shape for each property being densified. This is faster and
avoids some GC pressure.

Depends on D113352

Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6804ae862058 part 1 - Use AutoCheckShapeConsistency in NativeObject::removeProperty. r=jonco https://hg.mozilla.org/integration/autoland/rev/9ca23b2a317a part 2 - Handle non-dictionary property removal first with an early return. r=jonco https://hg.mozilla.org/integration/autoland/rev/6e77fb213892 part 3 - Rename freeSlot to freeDictionarySlot and simplify it a bit. r=jonco https://hg.mozilla.org/integration/autoland/rev/877d6461487e part 4 - Add NativeObject::densifySparseElements. r=jonco https://hg.mozilla.org/integration/autoland/rev/4b56f6c94f2e part 5 - Add removeDictionaryPropertyWithoutReshape helper method. r=jonco https://hg.mozilla.org/integration/autoland/rev/b5521fed2101 part 6 - Use |continue| in densifySparseElements. r=jonco https://hg.mozilla.org/integration/autoland/rev/60ceda12b56d part 7 - Optimize sparse element densification. r=jonco https://hg.mozilla.org/integration/autoland/rev/a76135d2790a part 8 - Use HandleId for removeProperty argument. r=jonco
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: