bug 216112, "add ability to disable object tracking in jsd"

r=caillon, sr=brendan, a=asa

adds the ability to turn off the object tracking without having to disable the debugger.  should make a dormant venkman less of a performance impact.
This commit is contained in:
rginda%netscape.com 2003-08-14 22:49:09 +00:00
parent a7ee0ea322
commit 8f4d8cb810
5 changed files with 32 additions and 9 deletions

View File

@ -182,6 +182,11 @@ interface jsdIDebuggerService : nsISupports
* If HIDE_DISABLED_FRAMES is set, this is effectively set as well.
*/
const unsigned long MASK_TOP_FRAME_ONLY = 0x20;
/**
* When this flag is set, object creation will not be tracked. This will
* reduce the performance price you pay by enabling the debugger.
*/
const unsigned long DISABLE_OBJECT_TRACE = 0x40;
/**
* Debugger service flags.

View File

@ -122,15 +122,18 @@ _createJSDObject(JSDContext* jsdc, JSContext *cx, JSObject *obj)
JS_ASSERT(JSD_OBJECTS_LOCKED(jsdc));
jsdobj = (JSDObject*) calloc(1, sizeof(JSDObject));
if( jsdobj )
if (jsdobj)
{
JS_INIT_CLIST(&jsdobj->links);
JS_APPEND_LINK(&jsdobj->links, &jsdc->objectsList);
jsdobj->obj = obj;
JS_HashTableAdd(jsdc->objectsTable, obj, jsdobj);
if (jsdc->flags & JSD_DISABLE_OBJECT_TRACE)
return jsdobj;
/* walk the stack to find js frame (if any) causing creation */
while( NULL != (fp = JS_FrameIterator(cx, &iter)) )
while (NULL != (fp = JS_FrameIterator(cx, &iter)))
{
if( !JS_IsNativeFrame(cx, fp) )
{

View File

@ -118,6 +118,16 @@ _callHook(JSDContext *jsdc, JSContext *cx, JSStackFrame *fp, JSBool before,
if (!jsdc || !jsdc->inited)
return JS_FALSE;
if (!hook && !(jsdc->flags & JSD_COLLECT_PROFILE_DATA) &&
jsdc->flags & JSD_DISABLE_OBJECT_TRACE)
{
/* no hook to call, no profile data needs to be collected, and
* the client has object tracing disabled, so there is nothing
* to do here.
*/
return hookresult;
}
if (before && JS_IsConstructorFrame(cx, fp))
jsd_Constructing(jsdc, cx, JS_GetFrameThis(cx, fp), fp);

View File

@ -96,7 +96,7 @@
}
#define JSDS_MAJOR_VERSION 1
#define JSDS_MINOR_VERSION 1
#define JSDS_MINOR_VERSION 2
#define NS_CATMAN_CTRID "@mozilla.org/categorymanager;1"
#define NS_JSRT_CTRID "@mozilla.org/js/xpc/RuntimeService;1"
@ -3235,9 +3235,7 @@ class jsdASObserver : public nsIObserver
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
jsdASObserver ()
{
}
jsdASObserver () {}
};
NS_IMPL_THREADSAFE_ISUPPORTS1(jsdASObserver, nsIObserver);
@ -3267,15 +3265,17 @@ jsdASObserver::Observe (nsISupports *aSubject, const char *aTopic,
return rv;
rv = jsds->OnForRuntime(rt);
if (NS_FAILED(rv))
return rv;
return rv;
return jsds->SetFlags(JSD_DISABLE_OBJECT_TRACE);
}
NS_GENERIC_FACTORY_CONSTRUCTOR(jsdASObserver);
static const nsModuleComponentInfo components[] = {
{"JSDService", JSDSERVICE_CID, jsdServiceCtrID, jsdServiceConstructor},
{"JSDASObserver", JSDASO_CID, jsdASObserverCtrID, jsdASObserverConstructor}
{"JSDService", JSDSERVICE_CID, jsdServiceCtrID, jsdServiceConstructor},
{"JSDASObserver", JSDASO_CID, jsdASObserverCtrID, jsdASObserverConstructor}
};
NS_IMPL_NSGETMODULE(JavaScript_Debugger, components);

View File

@ -230,6 +230,11 @@ JSD_ClearAllProfileData(JSDContext* jsdc);
* If JSD_HIDE_DISABLED_FRAMES is set, this is effectively set as well.
*/
#define JSD_MASK_TOP_FRAME_ONLY 0x20
/*
* When this flag is set, object creation will not be tracked. This will
* reduce the performance price you pay by enabling the debugger.
*/
#define JSD_DISABLE_OBJECT_TRACE 0x40
extern JSD_PUBLIC_API(void)
JSD_SetContextFlags (JSDContext* jsdc, uint32 flags);