Commit 33ab5378 authored by jband%netscape.com's avatar jband%netscape.com
Browse files

fix bug 59588. Since js_MarkAtom is called *so* often but is usually...

fix bug 59588. Since js_MarkAtom is called *so* often but is usually short-circuited, we add a macro to get the shortcircuit flag in the 3 callers and avoid most of the calls. r=mccabe sr=brendan
parent 9827507e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1055,7 +1055,7 @@ fun_mark(JSContext *cx, JSObject *obj, void *arg)
    fun = (JSFunction *) JS_GetPrivate(cx, obj);
    if (fun) {
        if (fun->atom)
            js_MarkAtom(cx, fun->atom, arg);
            GC_MARK_ATOM(cx, fun->atom, arg);
        if (fun->script)
            js_MarkScript(cx, fun->script, arg);
    }
+7 −0
Original line number Diff line number Diff line
@@ -97,6 +97,13 @@ js_UnlockGCThing(JSContext *cx, void *thing);
extern void
js_MarkAtom(JSContext *cx, JSAtom *atom, void *arg);

/* We avoid a large number of unnecessary calls by doing the flag check first */
#define GC_MARK_ATOM(cx, atom, arg)                                           \
    JS_BEGIN_MACRO                                                            \
        if (!((atom)->flags & ATOM_MARK))                                     \
            js_MarkAtom(cx, atom, arg);                                       \
    JS_END_MACRO

extern void
js_MarkGCThing(JSContext *cx, void *thing, void *arg);

+1 −1
Original line number Diff line number Diff line
@@ -3133,7 +3133,7 @@ js_Mark(JSContext *cx, JSObject *obj, void *arg)
        for (sym = sprop->symbols; sym; sym = sym->next) {
            if (JSVAL_IS_INT(sym_id(sym)))
                continue;
            js_MarkAtom(cx, sym_atom(sym), arg);
            GC_MARK_ATOM(cx, sym_atom(sym), arg);
        }
#if JS_HAS_GETTER_SETTER
        if (sprop->attrs & (JSPROP_GETTER | JSPROP_SETTER)) {
+1 −1
Original line number Diff line number Diff line
@@ -805,7 +805,7 @@ js_MarkScript(JSContext *cx, JSScript *script, void *arg)
    length = map->length;
    vector = map->vector;
    for (i = 0; i < length; i++)
        js_MarkAtom(cx, vector[i], arg);
        GC_MARK_ATOM(cx, vector[i], arg);
}

jssrcnote *