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 =
* @param {CodeMap.CodeEntry} codeEntry Code entry object.
*/
CodeMap.prototype.addCode = function(start, codeEntry) {
this.removeAllCoveredNodes_(this.dynamics_, start, start + codeEntry.size);
this.dynamics_.insert(start, codeEntry);
};
......@@ -91,7 +92,9 @@ CodeMap.prototype.addCode = function(start, codeEntry) {
* @param {number} to The destination address.
*/
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.dynamics_.insert(to, removedNode.value);
};
......@@ -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
*/
......@@ -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.
*
......
......@@ -58,8 +58,7 @@ Profile.prototype.skipThisFunction = function(name) {
*/
Profile.Operation = {
MOVE: 0,
DELETE: 1,
TICK: 2
TICK: 1
};
......@@ -163,15 +162,13 @@ Profile.prototype.addFuncCode = function(
func.name = name;
}
var entry = this.codeMap_.findDynamicEntryByStartAddress(start);
if (entry) {
if (entry.size === size && entry.func === func) {
// Entry state has changed.
entry.state = state;
}
} else {
entry = new Profile.DynamicFuncCodeEntry(size, type, func, state);
this.codeMap_.addCode(start, entry);
if (entry && entry.size === size && entry.func === func) {
// Entry state has changed.
entry.state = state;
return entry;
}
entry = new Profile.DynamicFuncCodeEntry(size, type, func, state);
this.codeMap_.addCode(start, entry);
return entry;
};
......@@ -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.
*
......
......@@ -77,8 +77,7 @@ function SnapshotLogProcessor() {
processor: this.processCodeCreation },
'code-move': { parsers: [parseInt, parseInt],
processor: this.processCodeMove },
'code-delete': { parsers: [parseInt],
processor: this.processCodeDelete },
'code-delete': null,
'function-creation': null,
'function-move': null,
'function-delete': null,
......@@ -93,10 +92,6 @@ function SnapshotLogProcessor() {
print('Snapshot: Code move event for unknown code: 0x' +
addr.toString(16));
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) {
};
SnapshotLogProcessor.prototype.processCodeDelete = function(start) {
this.profile_.deleteCode(start);
};
SnapshotLogProcessor.prototype.processSnapshotPosition = function(addr, pos) {
this.serializedEntries_[pos] = this.profile_.findEntry(addr);
};
......@@ -155,8 +145,7 @@ function TickProcessor(
processor: this.processCodeCreation },
'code-move': { parsers: [parseInt, parseInt],
processor: this.processCodeMove },
'code-delete': { parsers: [parseInt],
processor: this.processCodeDelete },
'code-delete': null,
'sfi-move': { parsers: [parseInt, parseInt],
processor: this.processFunctionMove },
'snapshot-pos': { parsers: [parseInt, parseInt],
......@@ -195,9 +184,6 @@ function TickProcessor(
case op.MOVE:
print('Code move event for unknown code: 0x' + addr.toString(16));
break;
case op.DELETE:
print('Code delete event for unknown code: 0x' + addr.toString(16));
break;
case op.TICK:
// Only unknown PCs (the first frame) are reported as unaccounted,
// otherwise tick balance will be corrupted (this behavior is compatible
......@@ -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) {
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