Bug 470997 - TM: trace-test.js should throw an error when |test.jitstats| contains an unrecognized property name. r=gal
authorJeff Walden <jwalden@mit.edu>
Mon, 12 Jan 2009 18:06:22 -0800
changeset 23722 d0a0f0694cedcf5a01cebe37b15d1d781000149f
parent 23721 7dde0d72f7c82486f9ac5d53e334b9294c308ae8
child 23723 56128cae91c99e875dc8b918c1425c31bbda02ba
push id4690
push userrsayre@mozilla.com
push dateThu, 15 Jan 2009 07:42:55 +0000
treeherdermozilla-central@ddfa483fea2a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgal
bugs470997
milestone1.9.2a1pre
Bug 470997 - TM: trace-test.js should throw an error when |test.jitstats| contains an unrecognized property name. r=gal
js/src/trace-test.js
--- a/js/src/trace-test.js
+++ b/js/src/trace-test.js
@@ -41,22 +41,37 @@ function jitstatHandler(f)
     f("returnLoopExits");
     f("mergedLoopExits")
     f("noCompatInnerTrees");
 }
 
 function test(f)
 {
   if (!testName || testName == f.name) {
+    var expectedJITstats = f.jitstats;
+    if (expectedJITstats)
+    {
+      var expectedProps = {};
+      jitstatHandler(function(prop) {
+                       if (prop in expectedJITstats)
+                         expectedProps[prop] = true;
+                     });
+      for (var p in expectedJITstats)
+      {
+        if (!(p in expectedProps))
+          throw "Bad property in " + f.name + ".expected: " + p;
+      }
+    }
+
     // Collect our jit stats
     var localJITstats = {};
-    jitstatHandler(function(prop, local, global) {
+    jitstatHandler(function(prop) {
                      localJITstats[prop] = tracemonkey[prop];
                    });
-    check(f.name, f(), f.expected, localJITstats, f.jitstats);
+    check(f.name, f(), f.expected, localJITstats, expectedJITstats);
   }
 }
 
 function map_test(t, cases)
 {
   for (var i = 0; i < cases.length; i++) {
     function c() { return t(cases[i].input); }
     c.expected = cases[i].expected;