Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: tools/codemap.js

Issue 99054: TickProcessor script reimplemented in JavaScript. (Closed)
Patch Set: Addressed Soeren's comments Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/tools/profileview.js ('k') | tools/consarray.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/codemap.js
diff --git a/tools/codemap.js b/tools/codemap.js
index 5149cfc87371c5f87db3e04ab5945b014d329a27..32e03d6641113160c47cc86878fd23fce2b63485 100644
--- a/tools/codemap.js
+++ b/tools/codemap.js
@@ -47,6 +47,8 @@ devtools.profiler.CodeMap = function() {
*/
this.deleted_ = [];
+ this.dynamicsNameGen_ = new devtools.profiler.CodeMap.NameGenerator();
+
/**
* Static code entries. Used for libraries code.
*/
@@ -79,6 +81,8 @@ devtools.profiler.CodeMap.PAGE_SIZE =
* @param {devtools.profiler.CodeMap.CodeEntry} codeEntry Code entry object.
*/
devtools.profiler.CodeMap.prototype.addCode = function(start, codeEntry) {
+ var entryName = this.dynamicsNameGen_.getName(codeEntry.name);
+ codeEntry.name = entryName;
this.dynamics_.insert(start, codeEntry);
};
@@ -204,7 +208,22 @@ devtools.profiler.CodeMap.CodeEntry.prototype.getName = function() {
return this.name;
};
-
+
devtools.profiler.CodeMap.CodeEntry.prototype.toString = function() {
return this.name + ': ' + this.size.toString(16);
};
+
+
+devtools.profiler.CodeMap.NameGenerator = function() {
+ this.knownNames_ = [];
+};
+
+
+devtools.profiler.CodeMap.NameGenerator.prototype.getName = function(name) {
+ if (!(name in this.knownNames_)) {
+ this.knownNames_[name] = 0;
+ return name;
+ }
+ var count = ++this.knownNames_[name];
+ return name + ' {' + count + '}';
+};
« no previous file with comments | « test/mjsunit/tools/profileview.js ('k') | tools/consarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698