Bug 1291990 - Add groupOf shell function and group info to DumpObject. r=efaust
authorMichael Smith <michael@spinda.net>
Wed, 03 Aug 2016 20:24:09 -0700
changeset 308925 c67a9e05a2b5a1815e000ffd979c9252e20a1963
parent 308924 83657071c81a563400d8f83af7a0c816ba7eb7b6
child 308926 45be90d58d473544dd10eef4033602204a2ec0fe
push id30552
push userkwierso@gmail.com
push dateWed, 10 Aug 2016 23:15:29 +0000
treeherdermozilla-central@65520f4cf4cc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersefaust
bugs1291990
milestone51.0a1
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
Bug 1291990 - Add groupOf shell function and group info to DumpObject. r=efaust
js/src/jsobj.cpp
js/src/shell/js.cpp
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -3437,16 +3437,18 @@ void
 JSObject::dump(FILE* fp) const
 {
     const JSObject* obj = this;
     JSObject* globalObj = &global();
     fprintf(fp, "object %p from global %p [%s]\n", (void*) obj,
             (void*) globalObj, globalObj->getClass()->name);
     const Class* clasp = obj->getClass();
     fprintf(fp, "class %p %s\n", (const void*)clasp, clasp->name);
+    const ObjectGroup* group = obj->group();
+    fprintf(fp, "group %p\n", (const void*)group);
 
     fprintf(fp, "flags:");
     if (obj->isDelegate()) fprintf(fp, " delegate");
     if (!obj->is<ProxyObject>() && !obj->nonProxyIsExtensible()) fprintf(fp, " not_extensible");
     if (obj->isIndexed()) fprintf(fp, " indexed");
     if (obj->isBoundFunction()) fprintf(fp, " bound_function");
     if (obj->isQualifiedVarObj()) fprintf(fp, " varobj");
     if (obj->isUnqualifiedVarObj()) fprintf(fp, " unqualified_varobj");
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -3107,16 +3107,29 @@ ShapeOf(JSContext* cx, unsigned argc, JS
         return false;
     }
     JSObject* obj = &args[0].toObject();
     args.rval().set(JS_NumberValue(double(uintptr_t(obj->maybeShape()) >> 3)));
     return true;
 }
 
 static bool
+GroupOf(JSContext* cx, unsigned argc, JS::Value* vp)
+{
+    CallArgs args = CallArgsFromVp(argc, vp);
+    if (!args.get(0).isObject()) {
+        JS_ReportError(cx, "groupOf: object expected");
+        return false;
+    }
+    JSObject* obj = &args[0].toObject();
+    args.rval().set(JS_NumberValue(double(uintptr_t(obj->group()) >> 3)));
+    return true;
+}
+
+static bool
 Sleep_fn(JSContext* cx, unsigned argc, Value* vp)
 {
     ShellContext* sc = GetShellContext(cx);
     CallArgs args = CallArgsFromVp(argc, vp);
 
     TimeDuration duration = TimeDuration::FromSeconds(0.0);
     if (args.length() > 0) {
         double t_secs;
@@ -5449,16 +5462,20 @@ static const JSFunctionSpecWithHelp shel
 "setSharedArrayBuffer()",
 "  Install the SharedArrayBuffer object in the cross-worker mailbox.\n"
 "  setSharedArrayBuffer performs an ordering memory barrier.\n"),
 
     JS_FN_HELP("shapeOf", ShapeOf, 1, 0,
 "shapeOf(obj)",
 "  Get the shape of obj (an implementation detail)."),
 
+    JS_FN_HELP("groupOf", GroupOf, 1, 0,
+"groupOf(obj)",
+"  Get the group of obj (an implementation detail)."),
+
 #ifdef DEBUG
     JS_FN_HELP("arrayInfo", ArrayInfo, 1, 0,
 "arrayInfo(a1, a2, ...)",
 "  Report statistics about arrays."),
 #endif
 
     JS_FN_HELP("sleep", Sleep_fn, 1, 0,
 "sleep(dt)",