diff --git a/js/src/jit-test/tests/ion/bug1132128.js b/js/src/jit-test/tests/ion/bug1132128.js new file mode 100644 index 00000000000..b0d8dd1fdd3 --- /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); +} diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index 6ea3d47cd5a..9740e6354a2 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -6963,7 +6963,8 @@ class MRegExpExec bool writeRecoverData(CompactBufferWriter &writer) const MOZ_OVERRIDE; bool canRecoverOnBailout() const MOZ_OVERRIDE { - 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; } @@ -7008,7 +7009,8 @@ class MRegExpTest // 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; } @@ -7066,7 +7068,8 @@ class MRegExpReplace bool canRecoverOnBailout() const MOZ_OVERRIDE { // 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; }