Add file needed by some Map/Set tests (the tests were introduced for bug 697479). r=orange.
authorJason Orendorff <jorendorff@mozilla.com>
Fri, 20 Jan 2012 07:30:27 -0600
changeset 86221 51f43afa160ed590ff22845a8e1bd0b621e23bf4
parent 86220 2cabdf75c971bc0236efd949df022c76871d7b29
child 86222 38b4039f740e5a07644b376cbd5809eb468cd99a
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersorange
bugs697479
milestone12.0a1
Add file needed by some Map/Set tests (the tests were introduced for bug 697479). r=orange.
js/src/jit-test/lib/referencesVia.js
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/lib/referencesVia.js
@@ -0,0 +1,26 @@
+function referencesVia(from, edge, to) {
+    if (typeof findReferences !== 'function')
+        return true;
+
+    edge = "edge: " + edge;
+    var edges = findReferences(to);
+    if (edge in edges && edges[edge].indexOf(from) != -1)
+        return true;
+
+    // Be nice: make it easy to fix if the edge name has just changed.
+    var alternatives = [];
+    for (var e in edges) {
+        if (edges[e].indexOf(from) != -1)
+            alternatives.push(e);
+    }
+    if (alternatives.length == 0) {
+        print("referent not referred to by referrer after all");
+    } else {
+        print("referent is not referenced via: " + uneval(edge));
+        print("but it is referenced via:       " + uneval(alternatives));
+    }
+    print("all incoming edges, from any object:");
+    for (var e in edges)
+        print(e);
+    return false;
+}