Bug 1132128 - Don't use recover instructions for MRegExp* instructions. rs=nbp, a=sledru
authorJan de Mooij <jdemooij@mozilla.com>
Mon, 16 Feb 2015 23:12:05 +0100
changeset 249754 43d763ba54e87cbb201e1ab355a7bbc5fe2594f4
parent 249753 041646b83f9339048724144078d64ca610672e8b
child 249755 fb2fd73e30ec28bf31cfdbe63a7dd892b1ede7a5
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp, sledru
bugs1132128
milestone37.0a2
Bug 1132128 - Don't use recover instructions for MRegExp* instructions. rs=nbp, a=sledru
js/src/jit-test/tests/ion/bug1132128.js
js/src/jit/MIR.h
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/ion/bug1132128.js
@@ -0,0 +1,26 @@
+if (getJitCompilerOptions()["ion.warmup.trigger"] > 20)
+    setJitCompilerOption("ion.warmup.trigger", 20);
+function callRegExpTest(i) {
+    var s = "" + i;
+    var re = /(\d+)/;
+    re.test(s);
+    assertEq(RegExp.$1, s);
+}
+function callRegExpExec(i) {
+    var s = "" + i;
+    var re = /(\d+)/;
+    var res = re.exec(s);
+    assertEq(RegExp.$1, s);
+    return res;
+}
+function callRegExpReplace(i) {
+    var s = "" + i;
+    var re = /(\d+)/;
+    s.replace(re, "");
+    assertEq(RegExp.$1, s);
+}
+for (var i = 0; i < 60; i++) {
+    callRegExpTest(i);
+    callRegExpExec(i);
+    callRegExpReplace(i);
+}
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -6838,17 +6838,18 @@ class MRegExpExec
 
     MDefinition *regexp() const {
         return getOperand(1);
     }
 
     bool writeRecoverData(CompactBufferWriter &writer) const;
 
     bool canRecoverOnBailout() const {
-        if (regexp()->isRegExp())
+        // XXX: always return false for now, to work around bug 1132128.
+        if (false && regexp()->isRegExp())
             return !regexp()->toRegExp()->source()->needUpdateLastIndex();
         return false;
     }
 
     bool possiblyCalls() const {
         return true;
     }
 };
@@ -6883,17 +6884,18 @@ class MRegExpTest
         return true;
     }
 
     bool writeRecoverData(CompactBufferWriter &writer) const;
     bool canRecoverOnBailout() const {
         // RegExpTest has a side-effect on the regexp object's lastIndex
         // when sticky or global flags are set.
         // Return false unless we are sure it's not the case.
-        if (regexp()->isRegExp())
+        // XXX: always return false for now, to work around bug 1132128.
+        if (false && regexp()->isRegExp())
             return !regexp()->toRegExp()->source()->needUpdateLastIndex();
         return false;
     }
 };
 
 template <class Policy1>
 class MStrReplace
   : public MTernaryInstruction,
@@ -6941,17 +6943,18 @@ class MRegExpReplace
     static MRegExpReplace *New(TempAllocator &alloc, MDefinition *string, MDefinition *pattern, MDefinition *replacement) {
         return new(alloc) MRegExpReplace(string, pattern, replacement);
     }
 
     bool writeRecoverData(CompactBufferWriter &writer) const;
     bool canRecoverOnBailout() const {
         // RegExpReplace will zero the lastIndex field when global flag is set.
         // So we can only remove this if it's non-global.
-        if (pattern()->isRegExp())
+        // XXX: always return false for now, to work around bug 1132128.
+        if (false && pattern()->isRegExp())
             return !pattern()->toRegExp()->source()->global();
         return false;
     }
 };
 
 class MStringReplace
   : public MStrReplace< StringPolicy<1> >
 {