Brian Burg avatar Brian Burg committed 947555e

NEW: test-mgr

Comments (0)

Files changed (4)

add-jsprobemgr-class

 # HG changeset patch
-# Parent 29627096556a7cb43c84006d8785cfcc81418e57
+# Parent 4a826e7017d2e2b7c33e2755f84692073038afc2
 Add the ProbeManager class.
 
 diff --git a/js/src/Makefile.in b/js/src/Makefile.in
 new file mode 100644
 --- /dev/null
 +++ b/js/src/jsprobemgr.cpp
-@@ -0,0 +1,1670 @@
+@@ -0,0 +1,1679 @@
 +/* -*- Mode: c++; c-basic-offset: 4; tab-width: 40; indent-tabs-mode: nil -*- */
 +/* vim: set ts=40 sw=4 et tw=99: */
 +/* ***** BEGIN LICENSE BLOCK *****
 +{
 +    JS_ASSERT(item->isSealed());
 +    items.push_back(item);
-+    totalBytes += ProbeTypeData[item->leafType].bytes;
 +}
 +
 +void
 +        jsval curObj = argv[offset];
 +        uintN transformCount = (*it)->transforms.size();
 +
++        /* corner case: there are no transforms (i.e., we are unpacking an actual arg to the probe) */
++        if (transformCount == 0) {
++            argv[offset] = unpackedArgs[(*it)->payloadOffset];
++            continue;
++        }
++
 +        for (uintN i = 0; i < transformCount; i++) {
 +            ProbeTransform curTransform = (*it)->transforms[i];
 +            const char *nextPropName = ProbeFunctionData[curTransform].api_name;
 +        /* if need new argument, pull it off the va_list */
 +        else if (item->argn != lastArgn) {
 +            JS_ASSERT(item->argn > lastArgn); /* should catch misorderings */
-+            lastArgn = item->argn;
-+            void *curArgp = va_arg(argp, void*);
++            void *curArgp;
++
++            while (item->argn != lastArgn) {
++                curArgp = va_arg(argp, void*);
++                lastArgn++;
++            }
 +            curArg = ProbeValue(ty, &curArgp);
 +        }
 +
 add-jsprobes-core-definitions
 add-jsprobemgr-class
 jsprobes-dispatch-integration
+test-mgr
 jsshell-integration #+shell
 xpcom-nsIProbeService
-tmp-mgr
 
 
 
+# HG changeset patch
+# Parent 71189ce92edbcf2c597e7490edf038b2c23c9da4
+diff --git a/js/src/jsprobemgr.cpp b/js/src/jsprobemgr.cpp
+--- a/js/src/jsprobemgr.cpp
++++ b/js/src/jsprobemgr.cpp
+@@ -1020,6 +1020,8 @@
+ {
+     JS_ASSERT(hdesc);
+ 
++    /* root the script */
++    JS_AddNamedScriptRoot(adminCx, &hdesc->script, "dummy");
+     handlers(hdesc->probe).push_back(hdesc);
+     rebuildOrder(hdesc->probe);
+ }
+@@ -1029,6 +1031,9 @@
+ {
+     JS_ASSERT(hdesc);
+ 
++    /* unroot the script */
++    JS_RemoveScriptRoot(adminCx, &hdesc->script);
++
+     handlers(hdesc->probe).remove(hdesc);
+     rebuildOrder(hdesc->probe);
+ }
+@@ -1036,7 +1041,14 @@
+ void
+ ProbeManager::clearHandlers(ProbePoint probe)
+ {
+-    handlers(probe).clear();
++    HandlerDescList hlist = handlers(probe);
++
++    /* unroot all of the scripts */
++    for (HandlerDescList::iterator it = hlist.begin(); it != hlist.end(); it++) {
++        JS_RemoveScriptRoot(adminCx, &((*it)->script));
++    }
++
++    hlist.clear();
+     rebuildOrder(probe);
+ }
+ 
+@@ -1379,7 +1391,7 @@
+     globalObj = JS_GetGlobalObject(cx);
+ 
+     for (HandlerDescList::iterator it = hlist.begin(); it != hlist.end(); it++) {
+-        JS_CallFunction(cx, globalObj, (*it)->handlerFun, argc, argv, &rval);
++        JS_CallFunction(cx, globalObj, (*it)->script->function(), argc, argv, &rval);
+     }
+ 
+     cleanup:
+@@ -1473,11 +1485,10 @@
+ 
+     /* add as handler for this probe point */
+     handlerDesc = new HandlerDescriptor;
+-    handlerDesc->handlerFun = handlerFun;
++    handlerDesc->script = handlerFun->script();;
+     handlerDesc->probe = probe;
+     handlerDesc->order = order;
+     handlerDesc->cookie = newCookie;
+-    /* TODO: root handlerDesc->handlerFun? */
+     addHandler(handlerDesc);
+ 
+     /* register and return the handler's cookie */
+diff --git a/js/src/jsprobemgr.h b/js/src/jsprobemgr.h
+--- a/js/src/jsprobemgr.h
++++ b/js/src/jsprobemgr.h
+@@ -62,7 +62,7 @@
+ };
+ 
+ struct HandlerDescriptor {
+-    JSFunction *handlerFun;
++    JSScript *script;
+     ProbePoint probe;
+     PickOrder *order;
+     HandlerCookie cookie;

tmp-mgr

-# HG changeset patch
-# Parent 6fad47c909c43375dc7e7c86db21f3b143495e72
-diff --git a/js/src/jsprobemgr.cpp b/js/src/jsprobemgr.cpp
---- a/js/src/jsprobemgr.cpp
-+++ b/js/src/jsprobemgr.cpp
-@@ -246,7 +246,6 @@
- {
-     JS_ASSERT(item->isSealed());
-     items.push_back(item);
--    totalBytes += ProbeTypeData[item->leafType].bytes;
- }
- 
- void
-@@ -1313,6 +1312,12 @@
-         jsval curObj = argv[offset];
-         uintN transformCount = (*it)->transforms.size();
- 
-+        /* corner case: there are no transforms (i.e., we are unpacking an actual arg to the probe) */
-+        if (transformCount == 0) {
-+            argv[offset] = unpackedArgs[(*it)->payloadOffset];
-+            continue;
-+        }
-+
-         for (uintN i = 0; i < transformCount; i++) {
-             ProbeTransform curTransform = (*it)->transforms[i];
-             const char *nextPropName = ProbeFunctionData[curTransform].api_name;
-@@ -1579,8 +1584,12 @@
-         /* if need new argument, pull it off the va_list */
-         else if (item->argn != lastArgn) {
-             JS_ASSERT(item->argn > lastArgn); /* should catch misorderings */
--            lastArgn = item->argn;
--            void *curArgp = va_arg(argp, void*);
-+            void *curArgp;
-+
-+            while (item->argn != lastArgn) {
-+                curArgp = va_arg(argp, void*);
-+                lastArgn++;
-+            }
-             curArg = ProbeValue(ty, &curArgp);
-         }
- 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.