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

Side by Side Diff: tools/codemap.js

Issue 125187: Use >>> instead of >> in order to cover the full 32 bit range when... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 this.statics_.insert(start, codeEntry); 119 this.statics_.insert(start, codeEntry);
120 }; 120 };
121 121
122 122
123 /** 123 /**
124 * @private 124 * @private
125 */ 125 */
126 devtools.profiler.CodeMap.prototype.markPages_ = function(start, end) { 126 devtools.profiler.CodeMap.prototype.markPages_ = function(start, end) {
127 for (var addr = start; addr <= end; 127 for (var addr = start; addr <= end;
128 addr += devtools.profiler.CodeMap.PAGE_SIZE) { 128 addr += devtools.profiler.CodeMap.PAGE_SIZE) {
129 this.pages_[addr >> devtools.profiler.CodeMap.PAGE_ALIGNMENT] = 1; 129 this.pages_[addr >>> devtools.profiler.CodeMap.PAGE_ALIGNMENT] = 1;
130 } 130 }
131 }; 131 };
132 132
133 133
134 /** 134 /**
135 * @private 135 * @private
136 */ 136 */
137 devtools.profiler.CodeMap.prototype.isAddressBelongsTo_ = function(addr, node) { 137 devtools.profiler.CodeMap.prototype.isAddressBelongsTo_ = function(addr, node) {
138 return addr >= node.key && addr < (node.key + node.value.size); 138 return addr >= node.key && addr < (node.key + node.value.size);
139 }; 139 };
140 140
141 141
142 /** 142 /**
143 * @private 143 * @private
144 */ 144 */
145 devtools.profiler.CodeMap.prototype.findInTree_ = function(tree, addr) { 145 devtools.profiler.CodeMap.prototype.findInTree_ = function(tree, addr) {
146 var node = tree.findGreatestLessThan(addr); 146 var node = tree.findGreatestLessThan(addr);
147 return node && this.isAddressBelongsTo_(addr, node) ? node.value : null; 147 return node && this.isAddressBelongsTo_(addr, node) ? node.value : null;
148 }; 148 };
149 149
150 150
151 /** 151 /**
152 * Finds a code entry that contains the specified address. Both static and 152 * Finds a code entry that contains the specified address. Both static and
153 * dynamic code entries are considered. 153 * dynamic code entries are considered.
154 * 154 *
155 * @param {number} addr Address. 155 * @param {number} addr Address.
156 */ 156 */
157 devtools.profiler.CodeMap.prototype.findEntry = function(addr) { 157 devtools.profiler.CodeMap.prototype.findEntry = function(addr) {
158 var pageAddr = addr >> devtools.profiler.CodeMap.PAGE_ALIGNMENT; 158 var pageAddr = addr >>> devtools.profiler.CodeMap.PAGE_ALIGNMENT;
159 if (pageAddr in this.pages_) { 159 if (pageAddr in this.pages_) {
160 return this.findInTree_(this.statics_, addr); 160 return this.findInTree_(this.statics_, addr);
161 } 161 }
162 var min = this.dynamics_.findMin(); 162 var min = this.dynamics_.findMin();
163 var max = this.dynamics_.findMax(); 163 var max = this.dynamics_.findMax();
164 if (max != null && addr < (max.key + max.value.size) && addr >= min.key) { 164 if (max != null && addr < (max.key + max.value.size) && addr >= min.key) {
165 var dynaEntry = this.findInTree_(this.dynamics_, addr); 165 var dynaEntry = this.findInTree_(this.dynamics_, addr);
166 if (dynaEntry == null) return null; 166 if (dynaEntry == null) return null;
167 // Dedupe entry name. 167 // Dedupe entry name.
168 if (!dynaEntry.nameUpdated_) { 168 if (!dynaEntry.nameUpdated_) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 222
223 devtools.profiler.CodeMap.NameGenerator.prototype.getName = function(name) { 223 devtools.profiler.CodeMap.NameGenerator.prototype.getName = function(name) {
224 if (!(name in this.knownNames_)) { 224 if (!(name in this.knownNames_)) {
225 this.knownNames_[name] = 0; 225 this.knownNames_[name] = 0;
226 return name; 226 return name;
227 } 227 }
228 var count = ++this.knownNames_[name]; 228 var count = ++this.knownNames_[name];
229 return name + ' {' + count + '}'; 229 return name + ' {' + count + '}';
230 }; 230 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698