Closed Bug 1727328 Opened 1 year ago Closed 1 year ago

Add fast path for PlainObject allocation


(Core :: JavaScript Engine, task, P3)




93 Branch
Tracking Status
firefox93 --- fixed


(Reporter: jandem, Assigned: jandem)




(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

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

Depends on D123459

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.