mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Add gc::Mark and gc::IsMarked functions. (Bug 687843, r=billm)
Use overloading to choose the Mark/IsMarked function based on the static type of the argument. ---
This commit is contained in:
parent
6ba206e797
commit
178b6396f6
@ -178,6 +178,43 @@ MarkChildren(JSTracer *trc, JSScript *script);
|
||||
void
|
||||
MarkChildren(JSTracer *trc, JSXML *xml);
|
||||
|
||||
/*
|
||||
* Use function overloading to decide which function should be called based on
|
||||
* the type of the object. The static type is used at compile time to link to
|
||||
* the corresponding Mark/IsMarked function.
|
||||
*/
|
||||
inline void
|
||||
Mark(JSTracer *trc, const js::Value &v, const char *name)
|
||||
{
|
||||
MarkValue(trc, v, name);
|
||||
}
|
||||
|
||||
inline void
|
||||
Mark(JSTracer *trc, JSObject *o, const char *name)
|
||||
{
|
||||
MarkObject(trc, *o, name);
|
||||
}
|
||||
|
||||
inline bool
|
||||
IsMarked(JSContext *cx, const js::Value &v)
|
||||
{
|
||||
if (v.isMarkable())
|
||||
return !IsAboutToBeFinalized(cx, v.toGCThing());
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool
|
||||
IsMarked(JSContext *cx, JSObject *o)
|
||||
{
|
||||
return !IsAboutToBeFinalized(cx, o);
|
||||
}
|
||||
|
||||
inline bool
|
||||
IsMarked(JSContext *cx, Cell *cell)
|
||||
{
|
||||
return !IsAboutToBeFinalized(cx, cell);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user