Closed Bug 586053 Opened 14 years ago Closed 1 year ago

Function constructor misses opp'ty to (lazily create and then) share Function.prototype's emptyScope

Categories

(Core :: JavaScript Engine, defect)

defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: brendan, Unassigned)

Details

This is all under js_InitClass:

        fun = js_NewFunction(cx, NULL, constructor, nargs, 0, obj, atom);
        if (!fun)
            goto bad;

        AutoValueRooter tvr2(cx, ObjectValue(*fun));
        if (!DefineStandardSlot(cx, obj, key, atom, tvr2.value(), 0, named))
            goto bad;

For the case of the Function class, the js_NewFunction call and functions it calls will not find proto in the reserved (standard) slot of the global (obj here) and therefore it will make an empty scope for Function, the constructor object. Then when we define the toSource method, we'll lazily create and share Function.prototype.emptyScope.

Might be fixable by reordering the two paragraphs shown above, with rooting removed (we don't need that any longer).

/be
If we do what bug 584648 comment 5 wants, though, this bug is moot (I hope).

/be
Assignee: general → nobody
Severity: normal → S3
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.