do not use code deletions

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9229 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4d89e379
...@@ -79,6 +79,7 @@ CodeMap.PAGE_SIZE = ...@@ -79,6 +79,7 @@ CodeMap.PAGE_SIZE =
* @param {CodeMap.CodeEntry} codeEntry Code entry object. * @param {CodeMap.CodeEntry} codeEntry Code entry object.
*/ */
CodeMap.prototype.addCode = function(start, codeEntry) { CodeMap.prototype.addCode = function(start, codeEntry) {
this.removeAllCoveredNodes_(this.dynamics_, start, start + codeEntry.size);
this.dynamics_.insert(start, codeEntry); this.dynamics_.insert(start, codeEntry);
}; };
...@@ -91,7 +92,9 @@ CodeMap.prototype.addCode = function(start, codeEntry) { ...@@ -91,7 +92,9 @@ CodeMap.prototype.addCode = function(start, codeEntry) {
* @param {number} to The destination address. * @param {number} to The destination address.
*/ */
CodeMap.prototype.moveCode = function(from, to) { CodeMap.prototype.moveCode = function(from, to) {
if (from === to) return;
var removedNode = this.dynamics_.remove(from); var removedNode = this.dynamics_.remove(from);
this.removeAllCoveredNodes_(this.dynamics_, to, to + removedNode.value.size);
this.dynamics_.insert(to, removedNode.value); this.dynamics_.insert(to, removedNode.value);
}; };
...@@ -151,6 +154,26 @@ CodeMap.prototype.isAddressBelongsTo_ = function(addr, node) { ...@@ -151,6 +154,26 @@ CodeMap.prototype.isAddressBelongsTo_ = function(addr, node) {
}; };
/**
* @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;
};
/** /**
* @private * @private
*/ */
...@@ -234,6 +257,14 @@ CodeMap.prototype.getAllLibrariesEntries = function() { ...@@ -234,6 +257,14 @@ 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. * Creates a code entry object.
* *
......
...@@ -58,8 +58,7 @@ Profile.prototype.skipThisFunction = function(name) { ...@@ -58,8 +58,7 @@ Profile.prototype.skipThisFunction = function(name) {
*/ */
Profile.Operation = { Profile.Operation = {
MOVE: 0, MOVE: 0,
DELETE: 1, TICK: 1
TICK: 2
}; };
...@@ -163,15 +162,13 @@ Profile.prototype.addFuncCode = function( ...@@ -163,15 +162,13 @@ Profile.prototype.addFuncCode = function(
func.name = name; func.name = name;
} }
var entry = this.codeMap_.findDynamicEntryByStartAddress(start); var entry = this.codeMap_.findDynamicEntryByStartAddress(start);
if (entry) { if (entry && entry.size === size && entry.func === func) {
if (entry.size === size && entry.func === func) {
// Entry state has changed. // Entry state has changed.
entry.state = state; entry.state = state;
return entry;
} }
} else {
entry = new Profile.DynamicFuncCodeEntry(size, type, func, state); entry = new Profile.DynamicFuncCodeEntry(size, type, func, state);
this.codeMap_.addCode(start, entry); this.codeMap_.addCode(start, entry);
}
return entry; return entry;
}; };
...@@ -191,20 +188,6 @@ Profile.prototype.moveCode = function(from, to) { ...@@ -191,20 +188,6 @@ Profile.prototype.moveCode = function(from, to) {
}; };
/**
* Reports about deletion of a dynamic code entry.
*
* @param {number} start Starting address.
*/
Profile.prototype.deleteCode = function(start) {
try {
this.codeMap_.deleteCode(start);
} catch (e) {
this.handleUnknownCode(Profile.Operation.DELETE, start);
}
};
/** /**
* Reports about moving of a dynamic code entry. * Reports about moving of a dynamic code entry.
* *
......
...@@ -77,8 +77,7 @@ function SnapshotLogProcessor() { ...@@ -77,8 +77,7 @@ function SnapshotLogProcessor() {
processor: this.processCodeCreation }, processor: this.processCodeCreation },
'code-move': { parsers: [parseInt, parseInt], 'code-move': { parsers: [parseInt, parseInt],
processor: this.processCodeMove }, processor: this.processCodeMove },
'code-delete': { parsers: [parseInt], 'code-delete': null,
processor: this.processCodeDelete },
'function-creation': null, 'function-creation': null,
'function-move': null, 'function-move': null,
'function-delete': null, 'function-delete': null,
...@@ -93,10 +92,6 @@ function SnapshotLogProcessor() { ...@@ -93,10 +92,6 @@ function SnapshotLogProcessor() {
print('Snapshot: Code move event for unknown code: 0x' + print('Snapshot: Code move event for unknown code: 0x' +
addr.toString(16)); addr.toString(16));
break; break;
case op.DELETE:
print('Snapshot: Code delete event for unknown code: 0x' +
addr.toString(16));
break;
} }
}; };
...@@ -123,11 +118,6 @@ SnapshotLogProcessor.prototype.processCodeMove = function(from, to) { ...@@ -123,11 +118,6 @@ SnapshotLogProcessor.prototype.processCodeMove = function(from, to) {
}; };
SnapshotLogProcessor.prototype.processCodeDelete = function(start) {
this.profile_.deleteCode(start);
};
SnapshotLogProcessor.prototype.processSnapshotPosition = function(addr, pos) { SnapshotLogProcessor.prototype.processSnapshotPosition = function(addr, pos) {
this.serializedEntries_[pos] = this.profile_.findEntry(addr); this.serializedEntries_[pos] = this.profile_.findEntry(addr);
}; };
...@@ -155,8 +145,7 @@ function TickProcessor( ...@@ -155,8 +145,7 @@ function TickProcessor(
processor: this.processCodeCreation }, processor: this.processCodeCreation },
'code-move': { parsers: [parseInt, parseInt], 'code-move': { parsers: [parseInt, parseInt],
processor: this.processCodeMove }, processor: this.processCodeMove },
'code-delete': { parsers: [parseInt], 'code-delete': null,
processor: this.processCodeDelete },
'sfi-move': { parsers: [parseInt, parseInt], 'sfi-move': { parsers: [parseInt, parseInt],
processor: this.processFunctionMove }, processor: this.processFunctionMove },
'snapshot-pos': { parsers: [parseInt, parseInt], 'snapshot-pos': { parsers: [parseInt, parseInt],
...@@ -195,9 +184,6 @@ function TickProcessor( ...@@ -195,9 +184,6 @@ function TickProcessor(
case op.MOVE: case op.MOVE:
print('Code move event for unknown code: 0x' + addr.toString(16)); print('Code move event for unknown code: 0x' + addr.toString(16));
break; break;
case op.DELETE:
print('Code delete event for unknown code: 0x' + addr.toString(16));
break;
case op.TICK: case op.TICK:
// Only unknown PCs (the first frame) are reported as unaccounted, // Only unknown PCs (the first frame) are reported as unaccounted,
// otherwise tick balance will be corrupted (this behavior is compatible // otherwise tick balance will be corrupted (this behavior is compatible
...@@ -318,11 +304,6 @@ TickProcessor.prototype.processCodeMove = function(from, to) { ...@@ -318,11 +304,6 @@ TickProcessor.prototype.processCodeMove = function(from, to) {
}; };
TickProcessor.prototype.processCodeDelete = function(start) {
this.profile_.deleteCode(start);
};
TickProcessor.prototype.processFunctionMove = function(from, to) { TickProcessor.prototype.processFunctionMove = function(from, to) {
this.profile_.moveFunc(from, to); this.profile_.moveFunc(from, to);
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment