зеркало из https://github.com/mozilla/gecko-dev.git
Bug 737195 - Add barriers to JSFunction::atom; r=billm
This is only ever initialized, so it needs generational barriers, but not incremental barriers.
This commit is contained in:
Родитель
fd92a5be57
Коммит
e0c5a3c531
|
@ -249,6 +249,7 @@ struct Shape;
|
|||
class BaseShape;
|
||||
namespace types { struct TypeObject; }
|
||||
|
||||
typedef HeapPtr<JSAtom> HeapPtrAtom;
|
||||
typedef HeapPtr<JSObject> HeapPtrObject;
|
||||
typedef HeapPtr<JSFunction> HeapPtrFunction;
|
||||
typedef HeapPtr<JSString> HeapPtrString;
|
||||
|
|
|
@ -488,6 +488,7 @@ js::XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
|
|||
{
|
||||
JSContext *cx;
|
||||
JSFunction *fun;
|
||||
JSAtom *atom;
|
||||
uint32_t firstword; /* flag telling whether fun->atom is non-null,
|
||||
plus for fun->u.i.skipmin, fun->u.i.wrapper,
|
||||
and 14 bits reserved for future use */
|
||||
|
@ -507,6 +508,7 @@ js::XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
|
|||
}
|
||||
firstword = !!fun->atom;
|
||||
flagsword = (fun->nargs << 16) | fun->flags;
|
||||
atom = fun->atom;
|
||||
script = fun->script();
|
||||
} else {
|
||||
RootedVarObject parent(cx, NULL);
|
||||
|
@ -517,12 +519,13 @@ js::XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
|
|||
return false;
|
||||
if (!fun->clearType(cx))
|
||||
return false;
|
||||
atom = NULL;
|
||||
script = NULL;
|
||||
}
|
||||
|
||||
if (!JS_XDRUint32(xdr, &firstword))
|
||||
return false;
|
||||
if ((firstword & 1U) && !js_XDRAtom(xdr, &fun->atom))
|
||||
if ((firstword & 1U) && !js_XDRAtom(xdr, &atom))
|
||||
return false;
|
||||
if (!JS_XDRUint32(xdr, &flagsword))
|
||||
return false;
|
||||
|
@ -534,7 +537,8 @@ js::XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
|
|||
fun->nargs = flagsword >> 16;
|
||||
JS_ASSERT((flagsword & JSFUN_KINDMASK) >= JSFUN_INTERPRETED);
|
||||
fun->flags = uint16_t(flagsword);
|
||||
fun->setScript(script);
|
||||
fun->atom.init(atom);
|
||||
fun->initScript(script);
|
||||
if (!script->typeSetFunction(cx, fun))
|
||||
return false;
|
||||
JS_ASSERT(fun->nargs == fun->script()->bindings.countArgs());
|
||||
|
@ -587,7 +591,7 @@ JSFunction::trace(JSTracer *trc)
|
|||
}
|
||||
|
||||
if (atom)
|
||||
MarkStringUnbarriered(trc, &atom, "atom");
|
||||
MarkString(trc, &atom, "atom");
|
||||
|
||||
if (isInterpreted()) {
|
||||
if (u.i.script_)
|
||||
|
@ -1008,7 +1012,7 @@ fun_bind(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
/* Step 4-6, 10-11. */
|
||||
JSAtom *name = target->isFunction() ? target->toFunction()->atom : NULL;
|
||||
JSAtom *name = target->isFunction() ? target->toFunction()->atom.get() : NULL;
|
||||
|
||||
JSObject *funobj =
|
||||
js_NewFunction(cx, NULL, CallOrConstructBoundFunction, length,
|
||||
|
@ -1304,7 +1308,7 @@ js_NewFunction(JSContext *cx, JSObject *funobj, Native native, unsigned nargs,
|
|||
fun->flags |= JSFUN_EXTENDED;
|
||||
fun->initializeExtended();
|
||||
}
|
||||
fun->atom = atom;
|
||||
fun->atom.init(atom);
|
||||
|
||||
if (native && !fun->setSingletonType(cx))
|
||||
return NULL;
|
||||
|
@ -1332,7 +1336,7 @@ js_CloneFunctionObject(JSContext *cx, JSFunction *fun, JSObject *parent,
|
|||
} else {
|
||||
clone->u.n = fun->u.n;
|
||||
}
|
||||
clone->atom = fun->atom;
|
||||
clone->atom.init(fun->atom);
|
||||
|
||||
if (kind == JSFunction::ExtendedFinalizeKind) {
|
||||
clone->flags |= JSFUN_EXTENDED;
|
||||
|
|
|
@ -102,7 +102,7 @@ struct JSFunction : public JSObject
|
|||
} i;
|
||||
void *nativeOrScript;
|
||||
} u;
|
||||
JSAtom *atom; /* name for diagnostics and decompiling */
|
||||
js::HeapPtrAtom atom; /* name for diagnostics and decompiling */
|
||||
|
||||
bool optimizedClosure() const { return kind() > JSFUN_INTERPRETED; }
|
||||
bool isInterpreted() const { return kind() >= JSFUN_INTERPRETED; }
|
||||
|
|
|
@ -666,7 +666,7 @@ namespace js {
|
|||
static inline JSAtom *
|
||||
CallObjectLambdaName(JSFunction *fun)
|
||||
{
|
||||
return (fun->flags & JSFUN_LAMBDA) ? fun->atom : NULL;
|
||||
return (fun->flags & JSFUN_LAMBDA) ? fun->atom.get() : NULL;
|
||||
}
|
||||
|
||||
} /* namespace js */
|
||||
|
@ -678,7 +678,7 @@ JSObject::getDateUTCTime() const
|
|||
return getFixedSlot(JSSLOT_DATE_UTC_TIME);
|
||||
}
|
||||
|
||||
inline void
|
||||
inline void
|
||||
JSObject::setDateUTCTime(const js::Value &time)
|
||||
{
|
||||
JS_ASSERT(isDate());
|
||||
|
|
Загрузка…
Ссылка в новой задаче