mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 907937 - Inline jsval wrapping overload. r=billm
This thing is small enough now that it can be inlined. This is already a significant win because primitive jsval wrapping is now entirely inlined.
This commit is contained in:
parent
1e989152b6
commit
e6a0bd3c95
@ -202,33 +202,6 @@ JSCompartment::putWrapper(const CrossCompartmentKey &wrapped, const js::Value &w
|
||||
return crossCompartmentWrappers.put(wrapped, wrapper);
|
||||
}
|
||||
|
||||
bool
|
||||
JSCompartment::wrap(JSContext *cx, MutableHandleValue vp, HandleObject existingArg)
|
||||
{
|
||||
JS_ASSERT_IF(existingArg, vp.isObject());
|
||||
|
||||
/* Only GC things have to be wrapped or copied. */
|
||||
if (!vp.isMarkable())
|
||||
return true;
|
||||
|
||||
/* Handle strings. */
|
||||
if (vp.isString()) {
|
||||
JSString *str = vp.toString();
|
||||
if (!wrap(cx, &str))
|
||||
return false;
|
||||
vp.setString(str);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* All that's left are objects. */
|
||||
MOZ_ASSERT(vp.isObject());
|
||||
RootedObject obj(cx, &vp.toObject());
|
||||
if (!wrap(cx, &obj, existingArg))
|
||||
return false;
|
||||
vp.setObject(*obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
JSCompartment::wrap(JSContext *cx, JSString **strp)
|
||||
{
|
||||
|
@ -281,7 +281,33 @@ struct JSCompartment
|
||||
void markCrossCompartmentWrappers(JSTracer *trc);
|
||||
void markAllCrossCompartmentWrappers(JSTracer *trc);
|
||||
|
||||
bool wrap(JSContext *cx, JS::MutableHandleValue vp, JS::HandleObject existing = js::NullPtr());
|
||||
inline bool wrap(JSContext *cx, JS::MutableHandleValue vp,
|
||||
JS::HandleObject existing = js::NullPtr())
|
||||
{
|
||||
JS_ASSERT_IF(existing, vp.isObject());
|
||||
|
||||
/* Only GC things have to be wrapped or copied. */
|
||||
if (!vp.isMarkable())
|
||||
return true;
|
||||
|
||||
/* Handle strings. */
|
||||
if (vp.isString()) {
|
||||
JSString *str = vp.toString();
|
||||
if (!wrap(cx, &str))
|
||||
return false;
|
||||
vp.setString(str);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* All that's left are objects. */
|
||||
MOZ_ASSERT(vp.isObject());
|
||||
JS::RootedObject obj(cx, &vp.toObject());
|
||||
if (!wrap(cx, &obj, existing))
|
||||
return false;
|
||||
vp.setObject(*obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wrap(JSContext *cx, JSString **strp);
|
||||
bool wrap(JSContext *cx, js::HeapPtrString *strp);
|
||||
bool wrap(JSContext *cx, JS::MutableHandleObject obj,
|
||||
|
Loading…
Reference in New Issue
Block a user