Closed Bug 1628014 Opened 5 years ago Closed 3 years ago

Make Allocate functions call constructors

Categories

(Core :: JavaScript: GC, task, P3)

task

Tracking

()

RESOLVED FIXED
106 Branch
Tracking Status
firefox106 --- fixed

People

(Reporter: jonco, Assigned: sfink)

References

Details

Attachments

(2 files, 1 obsolete file)

Right now to allocate a GC thing you do something like:

  JSFooThing* foo = Allocate<JSFooThing>(cx);
  new (foo) JSFooThing(some, args);

It would be more idiomatic to pass the constructor argument through Allocate, like this:

  JSFooThing* foo = Allocate<JSFooThing>(cx, some, args);

In some cases we don't call a constructor at all, and that may be undefined behaviour depending on the class itself. Always calling a constructor would prevent this possibility.

See Also: → 1746699
Assignee: nobody → sphink
Status: NEW → ASSIGNED
Attachment #9258153 - Attachment description: Bug 1628014 - Add typed Cell::Allocate<T>() and cx->Allocate<T>() methods → Bug 1628014 - Add typed Cell::NewCell<T>() and cx->NewCell<T>() methods
Attachment #9258153 - Attachment description: Bug 1628014 - Add typed Cell::NewCell<T>() and cx->NewCell<T>() methods → Bug 1628014 - Add typed Cell::NewCell<T>() and cx->newCell<T>() methods
Attachment #9258403 - Attachment is obsolete: true
Blocks: 1785942
Pushed by sfink@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/34625c0ebf21 Add typed Cell::NewCell<T>() and cx->newCell<T>() methods r=jonco,tcampbell https://hg.mozilla.org/integration/autoland/rev/6952a8524c26 Replace StringT::emplace() methods with direct calls to constructor (from a friend struct). r=arai
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 106 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: