Bug 470737 - TM: "switch(1/0){case Infinity:}" 4X slower with JIT enabled. r=gal
authorJeff Walden <jwalden@mit.edu>
Mon, 22 Dec 2008 15:42:24 -0800
changeset 23117 8cb04e0ee22b8638089c976b0a4123f4c4bfabec
parent 23116 159f0ffacae9dea4ef04b1bb9c1920d1c976f426
child 23118 696553764912d0ff8c8f5744a2f950e73c856f30
push id4346
push userrsayre@mozilla.com
push dateFri, 26 Dec 2008 01:26:36 +0000
treeherdermozilla-central@8eb5a5b83a93 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgal
bugs470737
milestone1.9.2a1pre
Bug 470737 - TM: "switch(1/0){case Infinity:}" 4X slower with JIT enabled. r=gal
js/src/jstracer.cpp
js/src/trace-test.js
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -4628,17 +4628,19 @@ TraceRecorder::strictEquality(bool equal
         LIns* args[] = { r_ins, l_ins };
         x = lir->ins2i(LIR_eq, lir->insCall(&js_EqualStrings_ci, args), equal);
         cond = js_EqualStrings(JSVAL_TO_STRING(l), JSVAL_TO_STRING(r));
     } else {
         LOpcode op = (ltag != JSVAL_DOUBLE) ? LIR_eq : LIR_feq;
         x = lir->ins2(op, l_ins, r_ins);
         if (!equal)
             x = lir->ins_eq0(x);
-        cond = (l == r);
+        cond = (ltag == JSVAL_DOUBLE)
+               ? asNumber(l) == asNumber(r);
+               : l == r;
     }
     cond = (cond == equal);
 
     if (cmpCase) {
         /* Only guard if the same path may not always be taken. */
         if (!x->isconst())
             guard(cond, x, BRANCH_EXIT);
         return;
--- a/js/src/trace-test.js
+++ b/js/src/trace-test.js
@@ -3863,16 +3863,34 @@ function testCaseTypeMismatchBadness()
   return "no crash";
 }
 testCaseTypeMismatchBadness.expected = "no crash";
 testCaseTypeMismatchBadness.jitstats = {
     recorderAborted: 0
 };
 test(testCaseTypeMismatchBadness);
 
+function testDoubleComparison()
+{
+  for (var i = 0; i < 500000; ++i)
+  {
+    switch (1 / 0)
+    {
+      case Infinity:
+    }
+  }
+
+  return "finished";
+}
+testDoubleComparison.expected = "finished";
+testDoubleComparison.jitstats = {
+  sideExitIntoInterpreter: 1
+};
+test(testDoubleComparison);
+
 /*****************************************************************************
  *                                                                           *
  *  _____ _   _  _____ ______ _____ _______                                  *
  * |_   _| \ | |/ ____|  ____|  __ \__   __|                                 *
  *   | | |  \| | (___ | |__  | |__) | | |                                    *
  *   | | | . ` |\___ \|  __| |  _  /  | |                                    *
  *  _| |_| |\  |____) | |____| | \ \  | |                                    *
  * |_____|_| \_|_____/|______|_|  \_\ |_|                                    *