Bug 1369762 - Don't atomize empty function names when retrieving the unresolved name of a bound function. r=till
authorAndré Bargull <andre.bargull@gmail.com>
Fri, 02 Jun 2017 17:41:11 +0200
changeset 410708 45eded6a52c0bfa75cc7515579fd678e99572832
parent 410707 a6aa43c2ff31fa0b58c3ac097affb59013641e75
child 410709 1e14ae1885dcbad2241c59cb08152c16c62532a7
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs1369762
milestone55.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 1369762 - Don't atomize empty function names when retrieving the unresolved name of a bound function. r=till
js/src/jsfun.cpp
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -1389,23 +1389,28 @@ JSFunction::getUnresolvedName(JSContext*
             v.set(name);
         return true;
     }
 
     if (fun->isBoundFunction()) {
         // Bound functions are never unnamed.
         MOZ_ASSERT(name);
 
-        StringBuffer sb(cx);
-        if (!sb.append(cx->names().boundWithSpace) || !sb.append(name))
-            return false;
+        JSAtom* boundName;
+        if (name->length() > 0) {
+            StringBuffer sb(cx);
+            if (!sb.append(cx->names().boundWithSpace) || !sb.append(name))
+                return false;
 
-        JSAtom* boundName = sb.finishAtom();
-        if (!boundName)
-            return false;
+            boundName = sb.finishAtom();
+            if (!boundName)
+                return false;
+        } else {
+            boundName = cx->names().boundWithSpace;
+        }
 
         v.set(boundName);
         return true;
     }
 
     v.set(name != nullptr ? name : cx->names().empty);
     return true;
 }