Bug 676739 - Part 2: Migrate from AtomizeString to ToAtom. r=luke
authorYaron Tausky <yaron.tausky@gmail.com>
Fri, 06 Sep 2013 13:04:56 +0200
changeset 146177 3f272348bb63bcf92f615ec80d026968c16db50f
parent 146176 9cbd48387451e8cb14769eddecba4aedb41c594d
child 146178 be8536d49a60e1449437b024837f10eb5b7f0742
push id25244
push userryanvm@gmail.com
push dateMon, 09 Sep 2013 20:03:14 +0000
treeherdermozilla-central@f320b8c034bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs676739
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 676739 - Part 2: Migrate from AtomizeString to ToAtom. r=luke
js/src/builtin/RegExp.cpp
js/src/frontend/FoldConstants.cpp
js/src/jsstr.cpp
--- a/js/src/builtin/RegExp.cpp
+++ b/js/src/builtin/RegExp.cpp
@@ -264,21 +264,17 @@ CompileRegExpObject(JSContext *cx, RegEx
         return true;
     }
 
     RootedAtom source(cx);
     if (sourceValue.isUndefined()) {
         source = cx->runtime()->emptyString;
     } else {
         /* Coerce to string and compile. */
-        JSString *str = ToString<CanGC>(cx, sourceValue);
-        if (!str)
-            return false;
-
-        source = AtomizeString<CanGC>(cx, str);
+        source = ToAtom<CanGC>(cx, sourceValue);
         if (!source)
             return false;
     }
 
     RegExpFlag flags = RegExpFlag(0);
     if (args.hasDefined(1)) {
         RootedString flagStr(cx, ToString<CanGC>(cx, args[1]));
         if (!flagStr)
--- a/js/src/frontend/FoldConstants.cpp
+++ b/js/src/frontend/FoldConstants.cpp
@@ -81,20 +81,17 @@ FoldType(ExclusiveContext *cx, ParseNode
                 pn->pn_dval = d;
                 pn->setKind(PNK_NUMBER);
                 pn->setOp(JSOP_DOUBLE);
             }
             break;
 
           case PNK_STRING:
             if (pn->isKind(PNK_NUMBER)) {
-                JSString *str = js_NumberToString<CanGC>(cx, pn->pn_dval);
-                if (!str)
-                    return false;
-                pn->pn_atom = AtomizeString<CanGC>(cx, str);
+                pn->pn_atom = NumberToAtom<CanGC>(cx, pn->pn_dval);
                 if (!pn->pn_atom)
                     return false;
                 pn->setKind(PNK_STRING);
                 pn->setOp(JSOP_STRING);
             }
             break;
 
           default:;
--- a/js/src/jsstr.cpp
+++ b/js/src/jsstr.cpp
@@ -2157,26 +2157,19 @@ FindReplaceLength(JSContext *cx, RegExpS
          */
         JS_ASSERT(rdata.lambda);
         JS_ASSERT(!rdata.elembase->getOps()->lookupProperty);
         JS_ASSERT(!rdata.elembase->getOps()->getProperty);
 
         RootedValue match(cx);
         if (!res->createLastMatch(cx, &match))
             return false;
-        JSString *str = match.toString();
-
-        JSAtom *atom;
-        if (str->isAtom()) {
-            atom = &str->asAtom();
-        } else {
-            atom = AtomizeString<CanGC>(cx, str);
-            if (!atom)
-                return false;
-        }
+        JSAtom *atom = ToAtom<CanGC>(cx, match);
+        if (!atom)
+            return false;
 
         RootedValue v(cx);
         if (HasDataProperty(cx, rdata.elembase, AtomToId(atom), v.address()) && v.isString()) {
             rdata.repstr = v.toString()->ensureLinear(cx);
             if (!rdata.repstr)
                 return false;
             *sizep = rdata.repstr->length();
             return true;