Backed out changeset 58946916593b (bug 887016)
authorTooru Fujisawa <arai_a@mac.com>
Mon, 28 Mar 2016 06:49:53 +0900
changeset 290645 7596439fda73345a5eecddb205c2508967a8eaa7
parent 290644 5b5df43f8950ad898668b16f36fa410f80d126a2
child 290646 9cb8165a2a66701fc5550b19ba29b3fa3ffd4714
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs887016
milestone48.0a1
backs out58946916593bf635aad899497442fcfd884e97c0
Backed out changeset 58946916593b (bug 887016)
js/src/builtin/RegExp.js
--- a/js/src/builtin/RegExp.js
+++ b/js/src/builtin/RegExp.js
@@ -142,23 +142,17 @@ function RegExpMatch(string) {
             rx.lastIndex = fullUnicode ? AdvanceStringIndex(S, lastIndex) : lastIndex + 1;
         }
 
         // Step 6.e.iii.5.
         n++;
     }
 }
 
-// Checks if following properties and getters are not modified, and accessing
-// them not observed by content script:
-//   * global
-//   * sticky
-//   * exec
-//   * lastIndex
-function IsRegExpMethodOptimizable(rx) {
+function IsRegExpReplaceOptimizable(rx) {
     var RegExpProto = GetBuiltinPrototype("RegExp");
     // If RegExpPrototypeOptimizable and RegExpInstanceOptimizable succeed,
     // `RegExpProto.exec` is guaranteed to be data properties.
     return RegExpPrototypeOptimizable(RegExpProto) &&
            RegExpInstanceOptimizable(rx, RegExpProto) &&
            RegExpProto.exec === RegExp_prototype_Exec;
 }
 
@@ -187,17 +181,17 @@ function RegExpReplace(string, replaceVa
         replaceValue = ToString(replaceValue);
         firstDollarIndex = callFunction(std_String_indexOf, replaceValue, "$");
     }
 
     // Step 7.
     var global = !!rx.global;
 
     // Optimized paths for simple cases.
-    if (!functionalReplace && firstDollarIndex === -1 && IsRegExpMethodOptimizable(rx)) {
+    if (!functionalReplace && firstDollarIndex === -1 && IsRegExpReplaceOptimizable(rx)) {
         if (global) {
             if (lengthS < 0x7fff)
                 return RegExpGlobalReplaceShortOpt(rx, S, lengthS, replaceValue);
             return RegExpGlobalReplaceOpt(rx, S, lengthS, replaceValue);
         }
         return RegExpLocalReplaceOpt(rx, S, lengthS, replaceValue);
     }
 
@@ -526,39 +520,24 @@ function RegExpSearch(string) {
 
     // Step 2.
     if (!IsObject(rx))
         ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, rx === null ? "null" : typeof rx);
 
     // Step 3.
     var S = ToString(string);
 
-    var result;
-    if (IsRegExpMethodOptimizable(rx) && S.length < 0x7fff) {
-        var sticky = !!rx.sticky;
-
-        // Step 6.
-        result = RegExpSearcher(rx, S, 0, sticky);
-
-        // Step 8.
-        if (result === -1)
-            return -1;
-
-        // Step 9.
-        return result & 0x7fff;
-    }
-
     // Step 4.
     var previousLastIndex = rx.lastIndex;
 
     // Step 5.
     rx.lastIndex = 0;
 
     // Step 6.
-    result = RegExpExec(rx, S, false);
+    var result = RegExpExec(rx, S, false);
 
     // Step 7.
     rx.lastIndex = previousLastIndex;
 
     // Step 8.
     if (result === null)
         return -1;