Closed Bug 1727328 Opened 3 years ago Closed 3 years ago

Add fast path for PlainObject allocation

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
93 Branch
Tracking Status
firefox93 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

Details

Attachments

(8 files)

PlainObjects account for a large number of object allocations. We should move this out of the generic allocation code and add a fast path for all PlainObject allocations. This lets us cache the shape in the global for plain objects with default prototype.

This will also bypass the NewObjectCache for these allocations, getting us closer to removing it.

Other callers were recently changed to call PlainObject::createWithShape instead.
We can also do that for the remaining caller and then remove CopyTemplateObject.

Drive-by change: assert we don't reuse dictionary shapes for new objects.

  • NewBuiltinClassInstance<PlainObject> => NewPlainObject
  • NewObjectWithGivenProto<PlainObject> => NewPlainObjectWithProto

Depends on D123456

Depends on D123457

Depends on D123458

Drive-by clean-up: GuessObjectGCKind(0) returns AllocKind::OBJECT4, this is
equivalent to NewObjectGCKind() that we already use elsewhere for this.

Depends on D123459

Depends on D123460

Because plain objects are created with different AllocKinds, we use an array of
shapes for this. A bit annoying but because plain objects are so common it's
probably worth handling all of them.

Depends on D123461

This is faster for callers that already know the AllocKind.

Depends on D123462

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: