Closed Bug 962449 Opened 10 years ago Closed 10 years ago

Create a choke-point for class initialization

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: bholley, Assigned: bholley)

References

Details

Attachments

(6 files)

I have various patches in my queue for this, and it seemed self-contained enough to split out.

At the moment, we have a number of different points where we may potentially invoke a routine to initialize a standard class. In order to implement bug 959012, we need this all to funnel through GlobalObject::ensureConstructor. These patches do that.
Depends on: 959334
The former triggers all of the appropriate initialization, whereas the latter
is 'imaginary' in jsprototypes.h, which means that the is no initialization
function associated with it.
Attachment #8364722 - Flags: review?(jorendorff)
This isn't strictly necessary at this point. The basic issue is that there are
a few new classes (iterator stuff, intl stuff, and typed objects) that use this
kind of constructor bootstrap scheme, and each of them will need something like
this to move to ClassSpecs. But that doesn't actually need to happen until we
convert them. I wrote this patch before I realized this, and I believe it's
correct, so I figured I'd get it landed along with everything. But I'm also ok
to skip it for now.
Attachment #8364726 - Flags: review?(jorendorff)
Given that we've all talked about this now, switching some of these over to luke to spread the load.
Attachment #8364722 - Flags: review?(jorendorff) → review?(luke)
Attachment #8364723 - Flags: review?(jorendorff) → review?(luke)
Attachment #8364724 - Flags: review?(jorendorff) → review?(luke)
Attachment #8364725 - Flags: review?(jorendorff) → review?(luke)
Attachment #8364726 - Flags: review?(jorendorff) → review?(luke)
Attachment #8364722 - Flags: review?(luke) → review+
Attachment #8364723 - Flags: review?(luke) → review+
Attachment #8364724 - Flags: review?(luke) → review+
Attachment #8364725 - Flags: review?(luke) → review+
Attachment #8364726 - Flags: review?(luke) → review+
Oh I see. Rooting analysis is considered to be a separate platform:

https://tbpl.mozilla.org/?tree=Try&rev=1f20ebbd5d06
Comment on attachment 8368748 [details] [diff] [review]
Part 6 - Make various getOrCreate methods static to efficiently fix hazards. v1

Review of attachment 8368748 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/vm/GlobalObject.h
@@ +471,5 @@
>    public:
> +    static JSObject *getOrCreateIteratorPrototype(JSContext *cx,
> +                                                  Handle<GlobalObject*> global)
> +    {
> +        if (!global->ensureConstructor(cx, JSProto_Iterator))

Does ensureConstructor presumably create a Rooted for the global?  Seems like it should be static too, to avoid that.  Followup.
Attachment #8368748 - Flags: review?(jwalden+bmo) → review+
Blocks: 966845
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: