Disable regexp cloning optimization for global/sticky regexps, bug 728021. r=dmandelin a=akeybl
authorBrian Hackett <bhackett1024@gmail.com>
Tue, 13 Mar 2012 08:34:32 -0700
changeset 91847 ae7c1ff7e8d802fc7cf8386dc1fd6b1332f0cc0f
parent 91846 245b87d73a55dfd06d979ef83bf0ac650afefeda
child 91848 4dccca5a974e755e9673f93d200aeb6ae9c5a9f6
push idunknown
push userunknown
push dateunknown
reviewersdmandelin, akeybl
bugs728021
milestone13.0a2
Disable regexp cloning optimization for global/sticky regexps, bug 728021. r=dmandelin a=akeybl
js/src/methodjit/Compiler.cpp
--- a/js/src/methodjit/Compiler.cpp
+++ b/js/src/methodjit/Compiler.cpp
@@ -6926,17 +6926,17 @@ mjit::Compiler::jsop_regexp()
      * script could actually observe the effect of such cloning, by getting
      * or setting properties on it. Particular RegExp and String natives take
      * regular expressions as 'this' or an argument, and do not let that
      * expression escape and be accessed by the script, so avoid cloning in
      * these cases.
      */
     analyze::SSAUseChain *uses =
         analysis->useChain(analyze::SSAValue::PushedValue(PC - script->code, 0));
-    if (uses && uses->popped && !uses->next) {
+    if (uses && uses->popped && !uses->next && !reobj->global() && !reobj->sticky()) {
         jsbytecode *use = script->code + uses->offset;
         uint32_t which = uses->u.which;
         if (JSOp(*use) == JSOP_CALLPROP) {
             JSObject *callee = analysis->pushedTypes(use, 0)->getSingleton(cx);
             if (callee && callee->isFunction()) {
                 Native native = callee->toFunction()->maybeNative();
                 if (native == js::regexp_exec || native == js::regexp_test) {
                     frame.push(ObjectValue(*obj));