Closed Bug 1599071 Opened 10 months ago Closed 10 months ago

FinalizationGroupObject::construct shouldn't need to call getOrCreateFinalizationGroupPrototype

Categories

(Core :: JavaScript: GC, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox72 --- fixed

People

(Reporter: anba, Assigned: jonco)

Details

Attachments

(1 file)

These lines are probably not necessary:

 if (!proto) {
    proto =
        GlobalObject::getOrCreateFinalizationGroupPrototype(cx, cx->global());
    if (!proto) {
      return false;
    }
  }

because FinalizationGroupObject::class_ uses JSCLASS_HAS_CACHED_PROTO(JSProto_FinalizationGroup), so NewObjectWithClassProto<FinalizationGroupObject> will pick the correct default prototype if the proto argument is nullptr.

GlobalObject::getOrCreateFinalizationGroupPrototype can then be removed, too, because it is only called in this place.

(In reply to André Bargull [:anba] from comment #0)
Thanks, good find!

Assignee: nobody → jcoppeard
Priority: -- → P1
Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cefb0e6f314a
Remove unnecessary GlobalObject::getOrCreateFinalizationGroupPrototype r=anba
Status: NEW → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
You need to log in before you can comment on or make changes to this bug.