Bug 1326411 - Don't recompute locale data for each Unicode extension key. r=Waldo
authorAndré Bargull <andre.bargull@gmail.com>
Wed, 15 Feb 2017 02:47:50 -0800
changeset 343078 fde41ab81a44aa8755fbf319b2e3d7070152753c
parent 343077 725b158fecb0a3f16a75f40ea9b7dce749c3c19a
child 343079 0429b0b495da0839e459b0713e9a39adbd60386f
push id31369
push userkwierso@gmail.com
push dateThu, 16 Feb 2017 00:18:40 +0000
treeherdermozilla-central@e9b926463f9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersWaldo
bugs1326411
milestone54.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 1326411 - Don't recompute locale data for each Unicode extension key. r=Waldo
js/src/builtin/Intl.js
--- a/js/src/builtin/Intl.js
+++ b/js/src/builtin/Intl.js
@@ -941,22 +941,27 @@ function ResolveLocale(availableLocales,
     result.dataLocale = foundLocale;
 
     // Step 8.
     var supportedExtension = "-u";
 
     // Steps 9-11.
     var i = 0;
     var len = relevantExtensionKeys.length;
+    var foundLocaleData;
+    if (len > 0) {
+        // In this implementation, localeData is a function, not an object.
+        // Step 11.b.
+        foundLocaleData = localeData(foundLocale);
+    }
     while (i < len) {
-        // Steps 11.a-c.
+        // Step 11.a.
         var key = relevantExtensionKeys[i];
 
-        // In this implementation, localeData is a function, not an object.
-        var foundLocaleData = localeData(foundLocale);
+        // Step 11.c.
         var keyLocaleData = foundLocaleData[key];
 
         // Locale data provides default value.
         // Step 11.d.
         var value = keyLocaleData[0];
 
         // Locale tag may override.