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

Side by Side Diff: tracing/tracing/extras/importer/v8/log_reader.html

Issue 2390373003: Change all == to === and != to !== in trace viewer. (Closed)
Patch Set: more changes from code review Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 <link rel="import" href="/tracing/base/base.html"> 7 <link rel="import" href="/tracing/base/base.html">
8 <script> 8 <script>
9 'use strict'; 9 'use strict';
10 10
11 /** 11 /**
12 * @fileoverview Log Reader is used to process log file produced by V8. 12 * @fileoverview Log Reader is used to process log file produced by V8.
13 */ 13 */
14 tr.exportTo('tr.e.importer.v8', function() { 14 tr.exportTo('tr.e.importer.v8', function() {
15 /** 15 /**
16 * Creates a CSV lines parser. 16 * Creates a CSV lines parser.
17 */ 17 */
18 function CsvParser() { }; 18 function CsvParser() { }
19 19
20 /** 20 /**
21 * A regex for matching a CSV field. 21 * A regex for matching a CSV field.
22 * @private 22 * @private
23 */ 23 */
24 CsvParser.CSV_FIELD_RE_ = /^"((?:[^"]|"")*)"|([^,]*)/; 24 CsvParser.CSV_FIELD_RE_ = /^"((?:[^"]|"")*)"|([^,]*)/;
25 25
26 /** 26 /**
27 * A regex for matching a double quote. 27 * A regex for matching a double quote.
28 * @private 28 * @private
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 * Current line. 77 * Current line.
78 * @type {number} 78 * @type {number}
79 */ 79 */
80 this.lineNum_ = 0; 80 this.lineNum_ = 0;
81 81
82 /** 82 /**
83 * CSV lines parser. 83 * CSV lines parser.
84 * @type {CsvParser} 84 * @type {CsvParser}
85 */ 85 */
86 this.csvParser_ = new CsvParser(); 86 this.csvParser_ = new CsvParser();
87 }; 87 }
88 88
89 /** 89 /**
90 * Used for printing error messages. 90 * Used for printing error messages.
91 * 91 *
92 * @param {string} str Error message. 92 * @param {string} str Error message.
93 */ 93 */
94 LogReader.prototype.printError = function(str) { 94 LogReader.prototype.printError = function(str) {
95 // Do nothing. 95 // Do nothing.
96 }; 96 };
97 97
(...skipping 22 matching lines...) Expand all
120 * @param {number} func JS Function. 120 * @param {number} func JS Function.
121 * @param {Array.<string>} stack String representation of a stack. 121 * @param {Array.<string>} stack String representation of a stack.
122 * @return {Array.<number>} Processed stack. 122 * @return {Array.<number>} Processed stack.
123 */ 123 */
124 LogReader.prototype.processStack = function(pc, func, stack) { 124 LogReader.prototype.processStack = function(pc, func, stack) {
125 var fullStack = func ? [pc, func] : [pc]; 125 var fullStack = func ? [pc, func] : [pc];
126 var prevFrame = pc; 126 var prevFrame = pc;
127 for (var i = 0, n = stack.length; i < n; ++i) { 127 for (var i = 0, n = stack.length; i < n; ++i) {
128 var frame = stack[i]; 128 var frame = stack[i];
129 var firstChar = frame.charAt(0); 129 var firstChar = frame.charAt(0);
130 if (firstChar == '+' || firstChar == '-') { 130 if (firstChar === '+' || firstChar === '-') {
131 // An offset from the previous frame. 131 // An offset from the previous frame.
132 prevFrame += parseInt(frame, 16); 132 prevFrame += parseInt(frame, 16);
133 fullStack.push(prevFrame); 133 fullStack.push(prevFrame);
134 // Filter out possible 'overflow' string. 134 // Filter out possible 'overflow' string.
135 } else if (firstChar != 'o') { 135 } else if (firstChar !== 'o') {
136 fullStack.push(parseInt(frame, 16)); 136 fullStack.push(parseInt(frame, 16));
137 } 137 }
138 } 138 }
139 return fullStack; 139 return fullStack;
140 }; 140 };
141 141
142 /** 142 /**
143 * Returns whether a particular dispatch must be skipped. 143 * Returns whether a particular dispatch must be skipped.
144 * 144 *
145 * @param {!Object} dispatch Dispatch record. 145 * @param {!Object} dispatch Dispatch record.
(...skipping 19 matching lines...) Expand all
165 if (dispatch === null || this.skipDispatch(dispatch)) { 165 if (dispatch === null || this.skipDispatch(dispatch)) {
166 return; 166 return;
167 } 167 }
168 168
169 // Parse fields. 169 // Parse fields.
170 var parsedFields = []; 170 var parsedFields = [];
171 for (var i = 0; i < dispatch.parsers.length; ++i) { 171 for (var i = 0; i < dispatch.parsers.length; ++i) {
172 var parser = dispatch.parsers[i]; 172 var parser = dispatch.parsers[i];
173 if (parser === null) { 173 if (parser === null) {
174 parsedFields.push(fields[1 + i]); 174 parsedFields.push(fields[1 + i]);
175 } else if (typeof parser == 'function') { 175 } else if (typeof parser === 'function') {
176 parsedFields.push(parser(fields[1 + i])); 176 parsedFields.push(parser(fields[1 + i]));
177 } else { 177 } else {
178 // var-args 178 // var-args
179 parsedFields.push(fields.slice(1 + i)); 179 parsedFields.push(fields.slice(1 + i));
180 break; 180 break;
181 } 181 }
182 } 182 }
183 183
184 // Run the processor. 184 // Run the processor.
185 dispatch.processor.apply(this, parsedFields); 185 dispatch.processor.apply(this, parsedFields);
(...skipping 18 matching lines...) Expand all
204 this.printError('line ' + (this.lineNum_ + 1) + ': ' + 204 this.printError('line ' + (this.lineNum_ + 1) + ': ' +
205 (e.message || e)); 205 (e.message || e));
206 } 206 }
207 } 207 }
208 }; 208 };
209 return { 209 return {
210 LogReader: LogReader 210 LogReader: LogReader
211 }; 211 };
212 }); 212 });
213 </script> 213 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/extras/importer/v8/codemap.html ('k') | tracing/tracing/extras/importer/v8/splaytree.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698