Bug 1353694. r=jonco, a=jcristau
authorAndré Bargull <andre.bargull@gmail.com>
Thu, 06 Apr 2017 16:35:01 +0200
changeset 393535 8c3b90886a8c8aac5d94e26e3fe262cbc82b625e
parent 393534 0e6f81e3f63e6ffd7bf03067975ce58755b55244
child 393536 23e8c43d48b36b1306d4d116d9cbfa7ab28a6d81
push id7198
push userjlorenzo@mozilla.com
push dateTue, 18 Apr 2017 12:07:49 +0000
treeherdermozilla-beta@d57aa49c3948 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco, jcristau
bugs1353694
milestone54.0a2
Bug 1353694. r=jonco, a=jcristau
js/src/builtin/Intl.cpp
js/src/builtin/Intl.h
--- a/js/src/builtin/Intl.cpp
+++ b/js/src/builtin/Intl.cpp
@@ -2809,17 +2809,17 @@ js::SharedIntlData::validateTimeZoneName
     if (TimeZoneSet::Ptr p = availableTimeZones.lookup(lookup))
         result.set(*p);
 
     return true;
 }
 
 bool
 js::SharedIntlData::tryCanonicalizeTimeZoneConsistentWithIANA(JSContext* cx, HandleString timeZone,
-                                                              MutableHandleString result)
+                                                              MutableHandleAtom result)
 {
     if (!ensureTimeZones(cx))
         return false;
 
     RootedLinearString timeZoneLinear(cx, timeZone->ensureLinear(cx));
     if (!timeZoneLinear)
         return false;
 
@@ -2903,21 +2903,22 @@ js::intl_canonicalizeTimeZone(JSContext*
     MOZ_ASSERT(args.length() == 1);
     MOZ_ASSERT(args[0].isString());
 
     SharedIntlData& sharedIntlData = cx->runtime()->sharedIntlData.ref();
 
     // Some time zone names are canonicalized differently by ICU -- handle
     // those first:
     RootedString timeZone(cx, args[0].toString());
-    RootedString ianaTimeZone(cx);
+    RootedAtom ianaTimeZone(cx);
     if (!sharedIntlData.tryCanonicalizeTimeZoneConsistentWithIANA(cx, timeZone, &ianaTimeZone))
         return false;
 
     if (ianaTimeZone) {
+        cx->markAtom(ianaTimeZone);
         args.rval().setString(ianaTimeZone);
         return true;
     }
 
     AutoStableStringChars stableChars(cx);
     if (!stableChars.initTwoByte(cx, timeZone))
         return false;
 
--- a/js/src/builtin/Intl.h
+++ b/js/src/builtin/Intl.h
@@ -162,17 +162,17 @@ class SharedIntlData
     /**
      * Returns the canonical time zone name in |result|. If no canonical name
      * was found, |result| remains unchanged.
      *
      * This method only handles time zones which are canonicalized differently
      * by ICU when compared to IANA.
      */
     bool tryCanonicalizeTimeZoneConsistentWithIANA(JSContext* cx, JS::HandleString timeZone,
-                                                   JS::MutableHandleString result);
+                                                   MutableHandleAtom result);
 
     void destroyInstance();
 
     void trace(JSTracer* trc);
 
     size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
 };