From: mikhail.naganov@gmail.com Date: Mon, 12 Sep 2011 10:50:40 +0000 (+0000) Subject: Revert accidental r9229 and r9230 X-Git-Tag: upstream/4.7.83~18501 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=57b9e9d968ed703212c466f44f7162852e3b2100;p=platform%2Fupstream%2Fv8.git Revert accidental r9229 and r9230 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9231 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/test/mjsunit/tools/codemap.js b/test/mjsunit/tools/codemap.js index bd48f2ec8..33d7e4e08 100644 --- a/test/mjsunit/tools/codemap.js +++ b/test/mjsunit/tools/codemap.js @@ -138,20 +138,6 @@ function assertNoEntry(codeMap, addr) { })(); -(function testDeadCodeCleanups() { - var codeMap = new CodeMap(); - codeMap.addCode(0x1500, newCodeEntry(0x200, 'code1')); - codeMap.addCode(0x1700, newCodeEntry(0x100, 'code2')); - assertEntry(codeMap, 'code1', 0x1500); - assertEntry(codeMap, 'code2', 0x1700); - codeMap.moveCode(0x1500, 0x1700); // Deprecate code2. - assertEntry(codeMap, 'code1', 0x1700); - codeMap.addCode(0x1750, newCodeEntry(0x100, 'code3')); - assertNoEntry(codeMap, 0x1700); - assertEntry(codeMap, 'code3', 0x1750); -})(); - - (function testDynamicNamesDuplicates() { var codeMap = new CodeMap(); // Code entries with same names but different addresses. diff --git a/tools/codemap.js b/tools/codemap.js index d7c52e829..dec494a3b 100644 --- a/tools/codemap.js +++ b/tools/codemap.js @@ -79,7 +79,6 @@ 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); }; @@ -92,9 +91,7 @@ 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); }; @@ -154,26 +151,6 @@ 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 */ @@ -257,14 +234,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. * diff --git a/tools/profile.js b/tools/profile.js index fe922faa0..10a07f824 100644 --- a/tools/profile.js +++ b/tools/profile.js @@ -58,7 +58,8 @@ Profile.prototype.skipThisFunction = function(name) { */ Profile.Operation = { MOVE: 0, - TICK: 1 + DELETE: 1, + TICK: 2 }; @@ -162,13 +163,15 @@ Profile.prototype.addFuncCode = function( func.name = name; } var entry = this.codeMap_.findDynamicEntryByStartAddress(start); - if (entry && entry.size === size && entry.func === func) { - // Entry state has changed. - entry.state = state; - return entry; + 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); } - entry = new Profile.DynamicFuncCodeEntry(size, type, func, state); - this.codeMap_.addCode(start, entry); return entry; }; @@ -188,6 +191,20 @@ 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. * diff --git a/tools/tickprocessor.js b/tools/tickprocessor.js index 1d058a00b..5f5783552 100644 --- a/tools/tickprocessor.js +++ b/tools/tickprocessor.js @@ -77,7 +77,8 @@ function SnapshotLogProcessor() { processor: this.processCodeCreation }, 'code-move': { parsers: [parseInt, parseInt], processor: this.processCodeMove }, - 'code-delete': null, + 'code-delete': { parsers: [parseInt], + processor: this.processCodeDelete }, 'function-creation': null, 'function-move': null, 'function-delete': null, @@ -92,6 +93,10 @@ 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; } }; @@ -118,6 +123,11 @@ 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); }; @@ -145,7 +155,8 @@ function TickProcessor( processor: this.processCodeCreation }, 'code-move': { parsers: [parseInt, parseInt], processor: this.processCodeMove }, - 'code-delete': null, + 'code-delete': { parsers: [parseInt], + processor: this.processCodeDelete }, 'sfi-move': { parsers: [parseInt, parseInt], processor: this.processFunctionMove }, 'snapshot-pos': { parsers: [parseInt, parseInt], @@ -184,6 +195,9 @@ 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 @@ -304,6 +318,11 @@ 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); };