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

Unified Diff: tools/codemap.js

Issue 7864017: Eliminate the need for code delete events in CPU profiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed test-log/EquivalenceOfLoggingAndTraversal Created 9 years, 3 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
« src/log.cc ('K') | « test/cctest/test-profile-generator.cc ('k') | no next file » | 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 d7c52e8298bacf84c59532dcd6c9f3f778b9f14d..f8a4f593f07aa5fbac1f716ef0120c5a15832451 100644
--- a/tools/codemap.js
+++ b/tools/codemap.js
@@ -79,7 +79,7 @@ CodeMap.PAGE_SIZE =
* @param {CodeMap.CodeEntry} codeEntry Code entry object.
*/
CodeMap.prototype.addCode = function(start, codeEntry) {
- this.removeAllCoveredNodes_(this.dynamics_, start, start + codeEntry.size);
+ this.deleteAllCoveredNodes_(this.dynamics_, start, start + codeEntry.size);
this.dynamics_.insert(start, codeEntry);
};
@@ -94,7 +94,7 @@ CodeMap.prototype.addCode = function(start, codeEntry) {
CodeMap.prototype.moveCode = function(from, to) {
if (from === to) return;
var removedNode = this.dynamics_.remove(from);
- this.removeAllCoveredNodes_(this.dynamics_, to, to + removedNode.value.size);
+ this.deleteAllCoveredNodes_(this.dynamics_, to, to + removedNode.value.size);
this.dynamics_.insert(to, removedNode.value);
};
@@ -149,28 +149,25 @@ CodeMap.prototype.markPages_ = function(start, end) {
/**
* @private
*/
-CodeMap.prototype.isAddressBelongsTo_ = function(addr, node) {
- return addr >= node.key && addr < (node.key + node.value.size);
+CodeMap.prototype.deleteAllCoveredNodes_ = function(tree, start, end) {
+ var to_delete = [];
+ var addr = end - 1;
+ while (addr >= start) {
+ var node = tree.findGreatestLessThan(addr);
+ if (!node) break;
+ var start2 = node.key, end2 = start2 + node.value.size;
+ if (start2 < end && start < end2) to_delete.push(start2);
+ addr = start2 - 1;
+ }
+ for (var i = 0, l = to_delete.length; i < l; ++i) tree.remove(to_delete[i]);
};
/**
* @private
*/
-CodeMap.prototype.findAllCoveredNodes_ = function(tree, start, end) {
- var result = [];
- var addr = end - 1;
- while (addr >= start) {
- var node = tree.findGreatestLessThan(addr);
- if (!node) break;
- var start2 = node.key, end2 = node.key + node.value.size;
- if (start2 < end && start < end2) {
- // Node overlaps with the interval given
- result.push(node);
- }
- addr = node.key - 1;
- }
- return result;
+CodeMap.prototype.isAddressBelongsTo_ = function(addr, node) {
+ return addr >= node.key && addr < (node.key + node.value.size);
};
@@ -257,14 +254,6 @@ CodeMap.prototype.getAllLibrariesEntries = function() {
};
-CodeMap.prototype.removeAllCoveredNodes_ = function(tree, start, end) {
- var covered = this.findAllCoveredNodes_(tree, start, end);
- for (var i = 0, l = covered.length; i < l; ++i) {
- tree.remove(covered[i].key);
- }
-};
-
-
/**
* Creates a code entry object.
*
« src/log.cc ('K') | « test/cctest/test-profile-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698