Bug 1259850 - Convert memoizer to Map, r=terrence
authorSteve Fink <sfink@mozilla.com>
Fri, 25 Mar 2016 15:18:57 -0700
changeset 338789 d91691bc2a5dd49a1f42ab4887c61b0464edfd62
parent 338788 a122f2f80ea9598ba1ea18b588bd9e06ba415063
child 338790 4d7b3fc568de1d7b510a2894629d0e4e43b19f71
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs1259850
milestone49.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 1259850 - Convert memoizer to Map, r=terrence MozReview-Commit-ID: 2Ps8gJpztw2
js/src/devtools/rootAnalysis/computeCallgraph.js
--- a/js/src/devtools/rootAnalysis/computeCallgraph.js
+++ b/js/src/devtools/rootAnalysis/computeCallgraph.js
@@ -99,27 +99,27 @@ function findVirtualFunctions(initialCSU
             for (var subclass of subclasses[csu])
                 worklist.push(subclass);
         }
     }
 
     return functions;
 }
 
-var memoized = {};
+var memoized = new Map();
 var memoizedCount = 0;
 
 function memo(name)
 {
-    if (!(name in memoized)) {
-        memoizedCount++;
-        memoized[name] = "" + memoizedCount;
-        print("#" + memoizedCount + " " + name);
+    if (!memoized.has(name)) {
+        let id = memoized.size + 1;
+        memoized.set(name, "" + id);
+        print(`#${id} ${name}`);
     }
-    return memoized[name];
+    return memoized.get(name);
 }
 
 var seenCallees = null;
 var seenSuppressedCallees = null;
 
 // Return a list of all callees that the given edge might be a call to. Each
 // one is represented by an object with a 'kind' field that is one of
 // ('direct', 'field', 'indirect', 'unknown').