Remove obsolete JSMarkOp API (bug 638291, r=jorendorff).

This commit is contained in:
Andreas Gal 2011-03-05 14:50:11 -08:00
parent 071d436568
commit f5b9aeb7d0
17 changed files with 77 additions and 141 deletions

View File

@ -261,11 +261,11 @@ static JSClass sCDataProtoClass = {
static JSClass sCTypeClass = {
"CType",
JSCLASS_HAS_RESERVED_SLOTS(CTYPE_SLOTS) | JSCLASS_MARK_IS_TRACE,
JSCLASS_HAS_RESERVED_SLOTS(CTYPE_SLOTS),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CType::Finalize,
NULL, NULL, CType::ConstructData, CType::ConstructData, NULL,
CType::HasInstance, JS_CLASS_TRACE(CType::Trace), NULL
CType::HasInstance, CType::Trace, NULL
};
static JSClass sCDataClass = {
@ -278,10 +278,10 @@ static JSClass sCDataClass = {
static JSClass sCClosureClass = {
"CClosure",
JSCLASS_HAS_RESERVED_SLOTS(CCLOSURE_SLOTS) | JSCLASS_MARK_IS_TRACE,
JSCLASS_HAS_RESERVED_SLOTS(CCLOSURE_SLOTS),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CClosure::Finalize,
NULL, NULL, NULL, NULL, NULL, NULL, JS_CLASS_TRACE(CClosure::Trace), NULL
NULL, NULL, NULL, NULL, NULL, NULL, CClosure::Trace, NULL
};
#define CTYPESFN_FLAGS \

View File

@ -64,7 +64,7 @@ namespace Library
static JSClass sLibraryClass = {
"Library",
JSCLASS_HAS_RESERVED_SLOTS(LIBRARY_SLOTS) | JSCLASS_MARK_IS_TRACE,
JSCLASS_HAS_RESERVED_SLOTS(LIBRARY_SLOTS),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub,JS_ResolveStub, JS_ConvertStub, Library::Finalize,
JSCLASS_NO_OPTIONAL_MEMBERS

View File

@ -2648,23 +2648,6 @@ JS_DumpHeap(JSContext *cx, FILE *fp, void* startThing, uint32 startKind,
#endif /* DEBUG */
JS_PUBLIC_API(void)
JS_MarkGCThing(JSContext *cx, jsval v, const char *name, void *arg)
{
JSTracer *trc;
trc = (JSTracer *)arg;
if (!trc)
trc = cx->runtime->gcMarkingTracer;
else
JS_ASSERT(trc == cx->runtime->gcMarkingTracer);
#ifdef JS_THREADSAFE
JS_ASSERT(cx->runtime->gcThread == trc->context->thread);
#endif
MarkValue(trc, Valueify(v), name ? name : "unknown");
}
extern JS_PUBLIC_API(JSBool)
JS_IsGCMarkingTracer(JSTracer *trc)
{
@ -4045,8 +4028,7 @@ prop_iter_trace(JSTracer *trc, JSObject *obj)
static Class prop_iter_class = {
"PropertyIterator",
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(1) |
JSCLASS_MARK_IS_TRACE,
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(1),
PropertyStub, /* addProperty */
PropertyStub, /* delProperty */
PropertyStub, /* getProperty */
@ -4061,7 +4043,7 @@ static Class prop_iter_class = {
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
JS_CLASS_TRACE(prop_iter_trace)
prop_iter_trace
};
JS_PUBLIC_API(JSObject *)

View File

@ -1561,13 +1561,6 @@ JS_UnlockGCThingRT(JSRuntime *rt, void *thing);
extern JS_PUBLIC_API(void)
JS_SetExtraGCRoots(JSRuntime *rt, JSTraceDataOp traceOp, void *data);
/*
* For implementors of JSMarkOp. All new code should implement JSTraceOp
* instead.
*/
extern JS_PUBLIC_API(void)
JS_MarkGCThing(JSContext *cx, jsval v, const char *name, void *arg);
/*
* JS_CallTracer API and related macros for implementors of JSTraceOp, to
* enumerate all references to traceable things reachable via a property or
@ -1941,7 +1934,7 @@ struct JSClass {
JSNative construct;
JSXDRObjectOp xdrObject;
JSHasInstanceOp hasInstance;
JSMarkOp mark;
JSTraceOp trace;
JSClassInternal reserved1;
void *reserved[19];
@ -1979,10 +1972,8 @@ struct JSClass {
#define JSCLASS_INTERNAL_FLAG1 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+0))
#define JSCLASS_IS_ANONYMOUS (1<<(JSCLASS_HIGH_FLAGS_SHIFT+1))
#define JSCLASS_IS_GLOBAL (1<<(JSCLASS_HIGH_FLAGS_SHIFT+2))
/* Indicates that JSClass.mark is a tracer with JSTraceOp type. */
#define JSCLASS_MARK_IS_TRACE (1<<(JSCLASS_HIGH_FLAGS_SHIFT+3))
#define JSCLASS_INTERNAL_FLAG2 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+4))
#define JSCLASS_INTERNAL_FLAG2 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+3))
#define JSCLASS_INTERNAL_FLAG3 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+4))
/* Indicate whether the proto or ctor should be frozen. */
#define JSCLASS_FREEZE_PROTO (1<<(JSCLASS_HIGH_FLAGS_SHIFT+5))

View File

@ -88,7 +88,7 @@ exn_resolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
Class js_ErrorClass = {
js_Error_str,
JSCLASS_HAS_PRIVATE | JSCLASS_NEW_RESOLVE | JSCLASS_MARK_IS_TRACE |
JSCLASS_HAS_PRIVATE | JSCLASS_NEW_RESOLVE |
JSCLASS_HAS_CACHED_PROTO(JSProto_Error),
PropertyStub, /* addProperty */
PropertyStub, /* delProperty */
@ -104,7 +104,7 @@ Class js_ErrorClass = {
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
JS_CLASS_TRACE(exn_trace)
exn_trace
};
typedef struct JSStackTraceElem {

View File

@ -833,7 +833,7 @@ Class js_ArgumentsClass = {
"Arguments",
JSCLASS_HAS_PRIVATE | JSCLASS_NEW_RESOLVE |
JSCLASS_HAS_RESERVED_SLOTS(JSObject::ARGS_CLASS_RESERVED_SLOTS) |
JSCLASS_MARK_IS_TRACE | JSCLASS_HAS_CACHED_PROTO(JSProto_Object),
JSCLASS_HAS_CACHED_PROTO(JSProto_Object),
PropertyStub, /* addProperty */
args_delProperty,
PropertyStub, /* getProperty */
@ -848,7 +848,7 @@ Class js_ArgumentsClass = {
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
JS_CLASS_TRACE(args_trace)
args_trace
};
namespace js {
@ -862,7 +862,7 @@ Class StrictArgumentsClass = {
"Arguments",
JSCLASS_HAS_PRIVATE | JSCLASS_NEW_RESOLVE |
JSCLASS_HAS_RESERVED_SLOTS(JSObject::ARGS_CLASS_RESERVED_SLOTS) |
JSCLASS_MARK_IS_TRACE | JSCLASS_HAS_CACHED_PROTO(JSProto_Object),
JSCLASS_HAS_CACHED_PROTO(JSProto_Object),
PropertyStub, /* addProperty */
args_delProperty,
PropertyStub, /* getProperty */
@ -877,7 +877,7 @@ Class StrictArgumentsClass = {
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
JS_CLASS_TRACE(args_trace)
args_trace
};
}
@ -1395,7 +1395,7 @@ JS_PUBLIC_DATA(Class) js_CallClass = {
"Call",
JSCLASS_HAS_PRIVATE |
JSCLASS_HAS_RESERVED_SLOTS(JSObject::CALL_RESERVED_SLOTS) |
JSCLASS_NEW_RESOLVE | JSCLASS_IS_ANONYMOUS | JSCLASS_MARK_IS_TRACE,
JSCLASS_NEW_RESOLVE | JSCLASS_IS_ANONYMOUS,
PropertyStub, /* addProperty */
PropertyStub, /* delProperty */
PropertyStub, /* getProperty */
@ -1410,7 +1410,7 @@ JS_PUBLIC_DATA(Class) js_CallClass = {
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
JS_CLASS_TRACE(call_trace)
call_trace
};
bool
@ -2009,7 +2009,7 @@ JS_PUBLIC_DATA(Class) js_FunctionClass = {
js_Function_str,
JSCLASS_HAS_PRIVATE | JSCLASS_NEW_RESOLVE |
JSCLASS_HAS_RESERVED_SLOTS(JSFunction::CLASS_RESERVED_SLOTS) |
JSCLASS_MARK_IS_TRACE | JSCLASS_HAS_CACHED_PROTO(JSProto_Function),
JSCLASS_HAS_CACHED_PROTO(JSProto_Function),
PropertyStub, /* addProperty */
PropertyStub, /* delProperty */
PropertyStub, /* getProperty */
@ -2024,7 +2024,7 @@ JS_PUBLIC_DATA(Class) js_FunctionClass = {
NULL, /* construct */
js_XDRFunctionObject,
fun_hasInstance,
JS_CLASS_TRACE(fun_trace)
fun_trace
};
JSString *

View File

@ -88,8 +88,7 @@ static JSObject *iterator_iterator(JSContext *cx, JSObject *obj, JSBool keysonly
Class js_IteratorClass = {
"Iterator",
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_CACHED_PROTO(JSProto_Iterator) |
JSCLASS_MARK_IS_TRACE,
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_CACHED_PROTO(JSProto_Iterator),
PropertyStub, /* addProperty */
PropertyStub, /* delProperty */
PropertyStub, /* getProperty */
@ -104,7 +103,7 @@ Class js_IteratorClass = {
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
JS_CLASS_TRACE(iterator_trace),
iterator_trace,
{
NULL, /* equality */
NULL, /* outerObject */
@ -1099,7 +1098,7 @@ generator_trace(JSTracer *trc, JSObject *obj)
Class js_GeneratorClass = {
js_Generator_str,
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_CACHED_PROTO(JSProto_Generator) |
JSCLASS_IS_ANONYMOUS | JSCLASS_MARK_IS_TRACE,
JSCLASS_IS_ANONYMOUS,
PropertyStub, /* addProperty */
PropertyStub, /* delProperty */
PropertyStub, /* getProperty */
@ -1114,7 +1113,7 @@ Class js_GeneratorClass = {
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
JS_CLASS_TRACE(generator_trace),
generator_trace,
{
NULL, /* equality */
NULL, /* outerObject */

View File

@ -6518,12 +6518,8 @@ js_TraceObject(JSTracer *trc, JSObject *obj)
/* No one runs while the GC is running, so we can use LOCKED_... here. */
Class *clasp = obj->getClass();
if (clasp->mark) {
if (clasp->flags & JSCLASS_MARK_IS_TRACE)
((JSTraceOp) clasp->mark)(trc, obj);
else if (IS_GC_MARKING_TRACER(trc))
(void) clasp->mark(cx, obj, trc);
}
if (clasp->trace)
clasp->trace(trc, obj);
if (clasp->flags & JSCLASS_IS_GLOBAL) {
JSCompartment *compartment = obj->getCompartment();
compartment->mark(trc);

View File

@ -339,14 +339,6 @@ typedef JSBool
typedef JSBool
(* JSHasInstanceOp)(JSContext *cx, JSObject *obj, const jsval *v, JSBool *bp);
/*
* Deprecated function type for JSClass.mark. All new code should define
* JSTraceOp instead to ensure the traversal of traceable things stored in
* the native structures.
*/
typedef uint32
(* JSMarkOp)(JSContext *cx, JSObject *obj, void *arg);
/*
* Function type for trace operation of the class called to enumerate all
* traceable things reachable from obj's private data structure. For each such
@ -363,27 +355,10 @@ typedef uint32
* the traversal is a part of the marking phase through calling
* JS_IsGCMarkingTracer and apply a special code like emptying caches or
* marking its native structures.
*
* To define the tracer for a JSClass, the implementation must add
* JSCLASS_MARK_IS_TRACE to class flags and use JS_CLASS_TRACE(method)
* macro below to convert JSTraceOp to JSMarkOp when initializing or
* assigning JSClass.mark field.
*/
typedef void
(* JSTraceOp)(JSTracer *trc, JSObject *obj);
#if defined __GNUC__ && __GNUC__ >= 4 && !defined __cplusplus
# define JS_CLASS_TRACE(method) \
(__builtin_types_compatible_p(JSTraceOp, __typeof(&(method))) \
? (JSMarkOp)(method) \
: js_WrongTypeForClassTracer)
extern JSMarkOp js_WrongTypeForClassTracer;
#else
# define JS_CLASS_TRACE(method) ((JSMarkOp)(method))
#endif
/*
* Tracer callback, called for each traceable thing directly referenced by a
* particular object or runtime structure. It is the callback responsibility

View File

@ -93,7 +93,7 @@ resc_trace(JSTracer *trc, JSObject *obj)
Class js::regexp_statics_class = {
"RegExpStatics",
JSCLASS_HAS_PRIVATE | JSCLASS_MARK_IS_TRACE,
JSCLASS_HAS_PRIVATE,
PropertyStub, /* addProperty */
PropertyStub, /* delProperty */
PropertyStub, /* getProperty */
@ -108,7 +108,7 @@ Class js::regexp_statics_class = {
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
JS_CLASS_TRACE(resc_trace)
resc_trace
};
/*
@ -549,7 +549,7 @@ js::Class js_RegExpClass = {
js_RegExp_str,
JSCLASS_HAS_PRIVATE | JSCLASS_NEW_RESOLVE |
JSCLASS_HAS_RESERVED_SLOTS(JSObject::REGEXP_CLASS_RESERVED_SLOTS) |
JSCLASS_MARK_IS_TRACE | JSCLASS_HAS_CACHED_PROTO(JSProto_RegExp),
JSCLASS_HAS_CACHED_PROTO(JSProto_RegExp),
PropertyStub, /* addProperty */
PropertyStub, /* delProperty */
PropertyStub, /* getProperty */
@ -564,7 +564,7 @@ js::Class js_RegExpClass = {
NULL, /* construct */
js_XDRRegExpObject,
NULL, /* hasInstance */
JS_CLASS_TRACE(regexp_trace)
regexp_trace
};
/*

View File

@ -775,7 +775,7 @@ script_trace(JSTracer *trc, JSObject *obj)
Class js_ScriptClass = {
"Script",
JSCLASS_HAS_PRIVATE |
JSCLASS_MARK_IS_TRACE | JSCLASS_HAS_CACHED_PROTO(JSProto_Object),
JSCLASS_HAS_CACHED_PROTO(JSProto_Object),
PropertyStub, /* addProperty */
PropertyStub, /* delProperty */
PropertyStub, /* getProperty */
@ -790,7 +790,7 @@ Class js_ScriptClass = {
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
JS_CLASS_TRACE(script_trace)
script_trace
};
/*

View File

@ -988,8 +988,7 @@ static const JSFinalizeOp FinalizeStub = JS_FinalizeStub;
Native construct; \
JSXDRObjectOp xdrObject; \
HasInstanceOp hasInstance; \
JSMarkOp mark
JSTraceOp trace;
/*
* The helper struct to measure the size of JS_CLASS_MEMBERS to know how much
@ -1058,7 +1057,7 @@ JS_STATIC_ASSERT(offsetof(JSClass, call) == offsetof(Class, call));
JS_STATIC_ASSERT(offsetof(JSClass, construct) == offsetof(Class, construct));
JS_STATIC_ASSERT(offsetof(JSClass, xdrObject) == offsetof(Class, xdrObject));
JS_STATIC_ASSERT(offsetof(JSClass, hasInstance) == offsetof(Class, hasInstance));
JS_STATIC_ASSERT(offsetof(JSClass, mark) == offsetof(Class, mark));
JS_STATIC_ASSERT(offsetof(JSClass, trace) == offsetof(Class, trace));
JS_STATIC_ASSERT(sizeof(JSClass) == sizeof(Class));
struct PropertyDescriptor {

View File

@ -224,7 +224,7 @@ JS_FRIEND_DATA(Class) js_NamespaceClass = {
"Namespace",
JSCLASS_CONSTRUCT_PROTOTYPE |
JSCLASS_HAS_RESERVED_SLOTS(JSObject::NAMESPACE_CLASS_RESERVED_SLOTS) |
JSCLASS_MARK_IS_TRACE | JSCLASS_HAS_CACHED_PROTO(JSProto_Namespace),
JSCLASS_HAS_CACHED_PROTO(JSProto_Namespace),
PropertyStub, /* addProperty */
PropertyStub, /* delProperty */
PropertyStub, /* getProperty */
@ -335,7 +335,7 @@ JS_FRIEND_DATA(Class) js_QNameClass = {
"QName",
JSCLASS_CONSTRUCT_PROTOTYPE |
JSCLASS_HAS_RESERVED_SLOTS(JSObject::QNAME_CLASS_RESERVED_SLOTS) |
JSCLASS_MARK_IS_TRACE | JSCLASS_HAS_CACHED_PROTO(JSProto_QName),
JSCLASS_HAS_CACHED_PROTO(JSProto_QName),
PropertyStub, /* addProperty */
PropertyStub, /* delProperty */
PropertyStub, /* getProperty */
@ -370,7 +370,7 @@ JS_FRIEND_DATA(Class) js_AttributeNameClass = {
js_AttributeName_str,
JSCLASS_CONSTRUCT_PROTOTYPE |
JSCLASS_HAS_RESERVED_SLOTS(JSObject::QNAME_CLASS_RESERVED_SLOTS) |
JSCLASS_MARK_IS_TRACE | JSCLASS_IS_ANONYMOUS,
JSCLASS_IS_ANONYMOUS,
PropertyStub, /* addProperty */
PropertyStub, /* delProperty */
PropertyStub, /* getProperty */
@ -385,7 +385,7 @@ JS_FRIEND_DATA(Class) js_AnyNameClass = {
js_AnyName_str,
JSCLASS_CONSTRUCT_PROTOTYPE |
JSCLASS_HAS_RESERVED_SLOTS(JSObject::QNAME_CLASS_RESERVED_SLOTS) |
JSCLASS_MARK_IS_TRACE | JSCLASS_IS_ANONYMOUS,
JSCLASS_IS_ANONYMOUS,
PropertyStub, /* addProperty */
PropertyStub, /* delProperty */
PropertyStub, /* getProperty */
@ -5115,7 +5115,7 @@ out:
JS_FRIEND_DATA(Class) js_XMLClass = {
js_XML_str,
JSCLASS_HAS_PRIVATE | JSCLASS_MARK_IS_TRACE |
JSCLASS_HAS_PRIVATE |
JSCLASS_HAS_CACHED_PROTO(JSProto_XML),
PropertyStub, /* addProperty */
PropertyStub, /* delProperty */
@ -5131,7 +5131,7 @@ JS_FRIEND_DATA(Class) js_XMLClass = {
NULL, /* construct */
NULL, /* xdrObject */
xml_hasInstance,
JS_CLASS_TRACE(xml_trace),
xml_trace,
JS_NULL_CLASS_EXT,
{
xml_lookupProperty,
@ -7566,7 +7566,7 @@ xmlfilter_finalize(JSContext *cx, JSObject *obj)
Class js_XMLFilterClass = {
"XMLFilter",
JSCLASS_HAS_PRIVATE | JSCLASS_IS_ANONYMOUS | JSCLASS_MARK_IS_TRACE,
JSCLASS_HAS_PRIVATE | JSCLASS_IS_ANONYMOUS,
PropertyStub, /* addProperty */
PropertyStub, /* delProperty */
PropertyStub, /* getProperty */
@ -7581,7 +7581,7 @@ Class js_XMLFilterClass = {
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
JS_CLASS_TRACE(xmlfilter_trace)
xmlfilter_trace
};
JSBool

View File

@ -3154,24 +3154,22 @@ split_finalize(JSContext *cx, JSObject *obj)
JS_free(cx, JS_GetPrivate(cx, obj));
}
static uint32
split_mark(JSContext *cx, JSObject *obj, void *arg)
static void
split_trace(JSTracer *trc, JSObject *obj)
{
ComplexObject *cpx;
cpx = (ComplexObject *) JS_GetPrivate(cx, obj);
cpx = (ComplexObject *) JS_GetPrivate(trc->context, obj);
if (!cpx->isInner && cpx->inner) {
/* Mark the inner object. */
JS_MarkGCThing(cx, OBJECT_TO_JSVAL(cpx->inner), "ComplexObject.inner", arg);
JS_CALL_TRACER(trc, cpx->inner, JSTRACE_OBJECT, "ComplexObject.inner");
}
if (cpx->isInner && cpx->outer) {
/* Mark the inner object. */
JS_MarkGCThing(cx, OBJECT_TO_JSVAL(cpx->outer), "ComplexObject.outer", arg);
JS_CALL_TRACER(trc, cpx->outer, JSTRACE_OBJECT, "ComplexObject.outer");
}
return 0;
}
static JSObject *
@ -3226,7 +3224,7 @@ static Class split_global_class = {
NULL, /* construct */
NULL, /* xdrObject */
NULL, /* hasInstance */
split_mark,
split_trace,
{
Valueify(split_equality),
split_outerObject,

View File

@ -1235,19 +1235,19 @@ Event::trace(JSTracer *trc)
}
JSClass ThreadPool::jsClass = {
"ThreadPool", JSCLASS_HAS_PRIVATE | JSCLASS_MARK_IS_TRACE,
"ThreadPool", JSCLASS_HAS_PRIVATE,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, jsFinalize,
NULL, NULL, NULL, NULL,
NULL, NULL, JS_CLASS_TRACE(jsTraceThreadPool), NULL
NULL, NULL, jsTraceThreadPool, NULL
};
JSClass Worker::jsWorkerClass = {
"Worker", JSCLASS_HAS_PRIVATE | JSCLASS_MARK_IS_TRACE,
"Worker", JSCLASS_HAS_PRIVATE,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, jsFinalize,
NULL, NULL, NULL, NULL,
NULL, NULL, JS_CLASS_TRACE(jsTraceWorker), NULL
NULL, NULL, jsTraceWorker, NULL
};
JSFunctionSpec Worker::jsMethods[3] = {

View File

@ -873,8 +873,7 @@ XPC_WN_OuterObject(JSContext *cx, JSObject *obj)
js::Class XPC_WN_NoHelper_JSClass = {
"XPCWrappedNative_NoHelper", // name;
WRAPPER_SLOTS |
JSCLASS_PRIVATE_IS_NSISUPPORTS |
JSCLASS_MARK_IS_TRACE, // flags;
JSCLASS_PRIVATE_IS_NSISUPPORTS, // flags
/* Mandatory non-null function pointer members. */
JS_VALUEIFY(js::PropertyOp, XPC_WN_OnlyIWrite_AddPropertyStub), // addProperty
@ -894,7 +893,7 @@ js::Class XPC_WN_NoHelper_JSClass = {
nsnull, // construct
nsnull, // xdrObject;
nsnull, // hasInstance
JS_CLASS_TRACE(XPC_WN_Shared_Trace), // mark/trace
XPC_WN_Shared_Trace, // mark/trace
// ClassExtension
{
@ -1465,8 +1464,7 @@ XPCNativeScriptableShared::PopulateJSClass(JSBool isGlobal)
mJSClass.base.flags = WRAPPER_SLOTS |
JSCLASS_PRIVATE_IS_NSISUPPORTS |
JSCLASS_NEW_RESOLVE |
JSCLASS_MARK_IS_TRACE;
JSCLASS_NEW_RESOLVE;
if(isGlobal)
mJSClass.base.flags |= JSCLASS_GLOBAL_FLAGS;
@ -1564,9 +1562,9 @@ XPCNativeScriptableShared::PopulateJSClass(JSBool isGlobal)
mJSClass.base.hasInstance = js::Valueify(XPC_WN_Helper_HasInstance);
if(mFlags.WantTrace())
mJSClass.base.mark = JS_CLASS_TRACE(XPC_WN_Helper_Trace);
mJSClass.base.trace = XPC_WN_Helper_Trace;
else
mJSClass.base.mark = JS_CLASS_TRACE(XPC_WN_Shared_Trace);
mJSClass.base.trace = XPC_WN_Shared_Trace;
if(mFlags.WantOuterObject())
mJSClass.base.ext.outerObject = XPC_WN_OuterObject;
@ -1768,7 +1766,7 @@ XPC_WN_ModsAllowed_Proto_Resolve(JSContext *cx, JSObject *obj, jsid id)
js::Class XPC_WN_ModsAllowed_WithCall_Proto_JSClass = {
"XPC_WN_ModsAllowed_WithCall_Proto_JSClass", // name;
WRAPPER_SLOTS | JSCLASS_MARK_IS_TRACE, // flags;
WRAPPER_SLOTS, // flags;
/* Mandatory non-null function pointer members. */
js::PropertyStub, // addProperty;
@ -1787,7 +1785,7 @@ js::Class XPC_WN_ModsAllowed_WithCall_Proto_JSClass = {
nsnull, // construct;
nsnull, // xdrObject;
nsnull, // hasInstance;
JS_CLASS_TRACE(XPC_WN_Shared_Proto_Trace), // mark/trace;
XPC_WN_Shared_Proto_Trace, // trace;
JS_NULL_CLASS_EXT,
XPC_WN_WithCall_ObjectOps
@ -1795,7 +1793,7 @@ js::Class XPC_WN_ModsAllowed_WithCall_Proto_JSClass = {
js::Class XPC_WN_ModsAllowed_NoCall_Proto_JSClass = {
"XPC_WN_ModsAllowed_NoCall_Proto_JSClass", // name;
WRAPPER_SLOTS | JSCLASS_MARK_IS_TRACE, // flags;
WRAPPER_SLOTS, // flags;
/* Mandatory non-null function pointer members. */
js::PropertyStub, // addProperty;
@ -1814,7 +1812,7 @@ js::Class XPC_WN_ModsAllowed_NoCall_Proto_JSClass = {
nsnull, // construct;
nsnull, // xdrObject;
nsnull, // hasInstance;
JS_CLASS_TRACE(XPC_WN_Shared_Proto_Trace), // mark/trace;
XPC_WN_Shared_Proto_Trace, // mark/trace;
JS_NULL_CLASS_EXT,
XPC_WN_NoCall_ObjectOps
@ -1885,7 +1883,7 @@ XPC_WN_NoMods_Proto_Resolve(JSContext *cx, JSObject *obj, jsid id)
js::Class XPC_WN_NoMods_WithCall_Proto_JSClass = {
"XPC_WN_NoMods_WithCall_Proto_JSClass", // name;
WRAPPER_SLOTS | JSCLASS_MARK_IS_TRACE, // flags;
WRAPPER_SLOTS, // flags;
/* Mandatory non-null function pointer members. */
JS_VALUEIFY(js::PropertyOp, XPC_WN_OnlyIWrite_Proto_AddPropertyStub), // addProperty;
@ -1904,7 +1902,7 @@ js::Class XPC_WN_NoMods_WithCall_Proto_JSClass = {
nsnull, // construct;
nsnull, // xdrObject;
nsnull, // hasInstance;
JS_CLASS_TRACE(XPC_WN_Shared_Proto_Trace), // mark/trace;
XPC_WN_Shared_Proto_Trace, // trace;
JS_NULL_CLASS_EXT,
XPC_WN_WithCall_ObjectOps
@ -1912,7 +1910,7 @@ js::Class XPC_WN_NoMods_WithCall_Proto_JSClass = {
js::Class XPC_WN_NoMods_NoCall_Proto_JSClass = {
"XPC_WN_NoMods_NoCall_Proto_JSClass", // name;
WRAPPER_SLOTS | JSCLASS_MARK_IS_TRACE, // flags;
WRAPPER_SLOTS, // flags;
/* Mandatory non-null function pointer members. */
JS_VALUEIFY(js::PropertyOp, XPC_WN_OnlyIWrite_Proto_AddPropertyStub), // addProperty;
@ -1931,7 +1929,7 @@ js::Class XPC_WN_NoMods_NoCall_Proto_JSClass = {
nsnull, // construct;
nsnull, // xdrObject;
nsnull, // hasInstance;
JS_CLASS_TRACE(XPC_WN_Shared_Proto_Trace), // mark/trace;
XPC_WN_Shared_Proto_Trace, // trace;
JS_NULL_CLASS_EXT,
XPC_WN_NoCall_ObjectOps
@ -1997,7 +1995,7 @@ XPC_WN_TearOff_Finalize(JSContext *cx, JSObject *obj)
js::Class XPC_WN_Tearoff_JSClass = {
"WrappedNative_TearOff", // name;
WRAPPER_SLOTS | JSCLASS_MARK_IS_TRACE, // flags;
WRAPPER_SLOTS, // flags;
JS_VALUEIFY(js::PropertyOp, XPC_WN_OnlyIWrite_AddPropertyStub), // addProperty;
JS_VALUEIFY(js::PropertyOp, XPC_WN_CannotModifyPropertyStub), // delProperty;

View File

@ -208,8 +208,8 @@ NPObjectMember_Finalize(JSContext *cx, JSObject *obj);
static JSBool
NPObjectMember_Call(JSContext *cx, uintN argc, jsval *vp);
static uint32
NPObjectMember_Mark(JSContext *cx, JSObject *obj, void *arg);
static void
NPObjectMember_Trace(JSTracer *trc, JSObject *obj);
static JSClass sNPObjectMemberClass =
{
@ -218,7 +218,7 @@ static JSClass sNPObjectMemberClass =
JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub,
JS_ResolveStub, NPObjectMember_Convert,
NPObjectMember_Finalize, nsnull, nsnull, NPObjectMember_Call,
nsnull, nsnull, nsnull, NPObjectMember_Mark, nsnull
nsnull, nsnull, nsnull, NPObjectMember_Trace, nsnull
};
static void
@ -2298,28 +2298,26 @@ NPObjectMember_Call(JSContext *cx, uintN argc, jsval *vp)
return ReportExceptionIfPending(cx);
}
static uint32
NPObjectMember_Mark(JSContext *cx, JSObject *obj, void *arg)
static void
NPObjectMember_Trace(JSTracer *trc, JSObject *obj)
{
NPObjectMemberPrivate *memberPrivate =
(NPObjectMemberPrivate *)::JS_GetInstancePrivate(cx, obj,
(NPObjectMemberPrivate *)::JS_GetInstancePrivate(trc->context, obj,
&sNPObjectMemberClass,
nsnull);
if (!memberPrivate)
return 0;
return;
if (!JSVAL_IS_PRIMITIVE(memberPrivate->fieldValue)) {
::JS_MarkGCThing(cx, memberPrivate->fieldValue,
"NPObject Member => fieldValue", arg);
JS_CALL_VALUE_TRACER(trc, memberPrivate->fieldValue,
"NPObject Member => fieldValue");
}
// There's no strong reference from our private data to the
// NPObject, so make sure to mark the NPObject wrapper to keep the
// NPObject alive as long as this NPObjectMember is alive.
if (memberPrivate->npobjWrapper) {
::JS_MarkGCThing(cx, OBJECT_TO_JSVAL(memberPrivate->npobjWrapper),
"NPObject Member => npobjWrapper", arg);
JS_CALL_OBJECT_TRACER(trc, memberPrivate->npobjWrapper,
"NPObject Member => npobjWrapper");
}
return 0;
}