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

Side by Side Diff: tools/codemap.js

Issue 99054: TickProcessor script reimplemented in JavaScript. (Closed)
Patch Set: Addressed Soeren's comments Created 11 years, 7 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 unified diff | Download patch
« no previous file with comments | « test/mjsunit/tools/profileview.js ('k') | tools/consarray.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 29 matching lines...) Expand all
40 /** 40 /**
41 * Dynamic code entries. Used for JIT compiled code. 41 * Dynamic code entries. Used for JIT compiled code.
42 */ 42 */
43 this.dynamics_ = new goog.structs.SplayTree(); 43 this.dynamics_ = new goog.structs.SplayTree();
44 44
45 /** 45 /**
46 * Deleted code entries. Used for code collected by the GC. 46 * Deleted code entries. Used for code collected by the GC.
47 */ 47 */
48 this.deleted_ = []; 48 this.deleted_ = [];
49 49
50 this.dynamicsNameGen_ = new devtools.profiler.CodeMap.NameGenerator();
51
50 /** 52 /**
51 * Static code entries. Used for libraries code. 53 * Static code entries. Used for libraries code.
52 */ 54 */
53 this.statics_ = new goog.structs.SplayTree(); 55 this.statics_ = new goog.structs.SplayTree();
54 56
55 /** 57 /**
56 * Map of memory pages occupied with static code. 58 * Map of memory pages occupied with static code.
57 */ 59 */
58 this.pages_ = []; 60 this.pages_ = [];
59 }; 61 };
(...skipping 12 matching lines...) Expand all
72 1 << devtools.profiler.CodeMap.PAGE_ALIGNMENT; 74 1 << devtools.profiler.CodeMap.PAGE_ALIGNMENT;
73 75
74 76
75 /** 77 /**
76 * Adds a dynamic (i.e. moveable and discardable) code entry. 78 * Adds a dynamic (i.e. moveable and discardable) code entry.
77 * 79 *
78 * @param {number} start The starting address. 80 * @param {number} start The starting address.
79 * @param {devtools.profiler.CodeMap.CodeEntry} codeEntry Code entry object. 81 * @param {devtools.profiler.CodeMap.CodeEntry} codeEntry Code entry object.
80 */ 82 */
81 devtools.profiler.CodeMap.prototype.addCode = function(start, codeEntry) { 83 devtools.profiler.CodeMap.prototype.addCode = function(start, codeEntry) {
84 var entryName = this.dynamicsNameGen_.getName(codeEntry.name);
85 codeEntry.name = entryName;
82 this.dynamics_.insert(start, codeEntry); 86 this.dynamics_.insert(start, codeEntry);
83 }; 87 };
84 88
85 89
86 /** 90 /**
87 * Moves a dynamic code entry. Throws an exception if there is no dynamic 91 * Moves a dynamic code entry. Throws an exception if there is no dynamic
88 * code entry with the specified starting address. 92 * code entry with the specified starting address.
89 * 93 *
90 * @param {number} from The starting address of the entry being moved. 94 * @param {number} from The starting address of the entry being moved.
91 * @param {number} to The destination address. 95 * @param {number} to The destination address.
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 devtools.profiler.CodeMap.CodeEntry = function(size, opt_name) { 201 devtools.profiler.CodeMap.CodeEntry = function(size, opt_name) {
198 this.size = size; 202 this.size = size;
199 this.name = opt_name || ''; 203 this.name = opt_name || '';
200 }; 204 };
201 205
202 206
203 devtools.profiler.CodeMap.CodeEntry.prototype.getName = function() { 207 devtools.profiler.CodeMap.CodeEntry.prototype.getName = function() {
204 return this.name; 208 return this.name;
205 }; 209 };
206 210
207 211
208 devtools.profiler.CodeMap.CodeEntry.prototype.toString = function() { 212 devtools.profiler.CodeMap.CodeEntry.prototype.toString = function() {
209 return this.name + ': ' + this.size.toString(16); 213 return this.name + ': ' + this.size.toString(16);
210 }; 214 };
215
216
217 devtools.profiler.CodeMap.NameGenerator = function() {
218 this.knownNames_ = [];
219 };
220
221
222 devtools.profiler.CodeMap.NameGenerator.prototype.getName = function(name) {
223 if (!(name in this.knownNames_)) {
224 this.knownNames_[name] = 0;
225 return name;
226 }
227 var count = ++this.knownNames_[name];
228 return name + ' {' + count + '}';
229 };
OLDNEW
« 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