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 243786 8597521cb8bd
parent 243785 7f4a993f3336
child 243787 cce919848572
child 243788 25c21c7ca6e7
child 243790 9e2391999085
push id4478
push userryanvm@gmail.com
push date2015-02-17 14:44 +0000
treeherdermozilla-beta@8597521cb8bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp, sledru
bugs1132128
milestone36.0
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
@@ -6816,17 +6816,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;
     }
 };
@@ -6861,17 +6862,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,
@@ -6919,17 +6921,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> >
 {