OLD | NEW |
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 */ | 132 */ |
133 devtools.profiler.LogReader.prototype.processLogChunk = function(chunk) { | 133 devtools.profiler.LogReader.prototype.processLogChunk = function(chunk) { |
134 this.processLog_(chunk.split('\n')); | 134 this.processLog_(chunk.split('\n')); |
135 }; | 135 }; |
136 | 136 |
137 | 137 |
138 /** | 138 /** |
139 * Processes stack record. | 139 * Processes stack record. |
140 * | 140 * |
141 * @param {number} pc Program counter. | 141 * @param {number} pc Program counter. |
| 142 * @param {number} func JS Function. |
142 * @param {Array.<string>} stack String representation of a stack. | 143 * @param {Array.<string>} stack String representation of a stack. |
143 * @return {Array.<number>} Processed stack. | 144 * @return {Array.<number>} Processed stack. |
144 */ | 145 */ |
145 devtools.profiler.LogReader.prototype.processStack = function(pc, stack) { | 146 devtools.profiler.LogReader.prototype.processStack = function(pc, func, stack) { |
146 var fullStack = [pc]; | 147 var fullStack = func ? [pc, func] : [pc]; |
147 var prevFrame = pc; | 148 var prevFrame = pc; |
148 for (var i = 0, n = stack.length; i < n; ++i) { | 149 for (var i = 0, n = stack.length; i < n; ++i) { |
149 var frame = stack[i]; | 150 var frame = stack[i]; |
150 var firstChar = frame.charAt(0); | 151 var firstChar = frame.charAt(0); |
151 if (firstChar == '+' || firstChar == '-') { | 152 if (firstChar == '+' || firstChar == '-') { |
152 // An offset from the previous frame. | 153 // An offset from the previous frame. |
153 prevFrame += parseInt(frame, 16); | 154 prevFrame += parseInt(frame, 16); |
154 fullStack.push(prevFrame); | 155 fullStack.push(prevFrame); |
155 // Filter out possible 'overflow' string. | 156 // Filter out possible 'overflow' string. |
156 } else if (firstChar != 'o') { | 157 } else if (firstChar != 'o') { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 * @param {Array.<string>} cmd Parsed command. | 312 * @param {Array.<string>} cmd Parsed command. |
312 * @private | 313 * @private |
313 */ | 314 */ |
314 devtools.profiler.LogReader.prototype.processRepeat_ = function(count, cmd) { | 315 devtools.profiler.LogReader.prototype.processRepeat_ = function(count, cmd) { |
315 // Replace the repeat-prefixed command from backrefs list with a non-prefixed. | 316 // Replace the repeat-prefixed command from backrefs list with a non-prefixed. |
316 this.backRefs_[0] = cmd.join(','); | 317 this.backRefs_[0] = cmd.join(','); |
317 for (var i = 0; i < count; ++i) { | 318 for (var i = 0; i < count; ++i) { |
318 this.dispatchLogRow_(cmd); | 319 this.dispatchLogRow_(cmd); |
319 } | 320 } |
320 }; | 321 }; |
OLD | NEW |