Make dumping of JS values that are native functions dump the filename and line number of the function. (Bug 510489) a2.0=DEBUG-only
authorL. David Baron <dbaron@dbaron.org>
Thu, 09 Dec 2010 20:38:53 -0800
changeset 59062 e71b310f048498af352c9b22e18e9624288257ac
parent 59061 64a2a38349278afb0ab42ebb82cb4ac54a44f5b0
child 59063 9103bd2267e78d3ea1b3524417f1c199c45f86dc
push id17507
push userdbaron@mozilla.com
push dateFri, 10 Dec 2010 04:40:06 +0000
treeherdermozilla-central@9103bd2267e7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs510489
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Make dumping of JS values that are native functions dump the filename and line number of the function. (Bug 510489) a2.0=DEBUG-only
js/src/jsobj.cpp
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -6538,16 +6538,21 @@ dumpValue(const Value &v)
         JSObject *funobj = &v.toObject();
         JSFunction *fun = GET_FUNCTION_PRIVATE(cx, funobj);
         if (fun->atom) {
             fputs("<function ", stderr);
             FileEscapedString(stderr, ATOM_TO_STRING(fun->atom), 0);
         } else {
             fputs("<unnamed function", stderr);
         }
+        if (fun->isInterpreted()) {
+            JSScript *script = fun->script();
+            fprintf(stderr, " (%s:%u)",
+                    script->filename ? script->filename : "", script->lineno);
+        }
         fprintf(stderr, " at %p (JSFunction at %p)>", (void *) funobj, (void *) fun);
     } else if (v.isObject()) {
         JSObject *obj = &v.toObject();
         Class *clasp = obj->getClass();
         fprintf(stderr, "<%s%s at %p>",
                 clasp->name,
                 (clasp == &js_ObjectClass) ? "" : " object",
                 (void *) obj);