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

Side by Side Diff: pkg/front_end/tool/fasta_perf.dart

Issue 2996163002: support class native clause (Closed)
Patch Set: update DietListener and test Created 3 years, 4 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
« no previous file with comments | « pkg/front_end/messages.yaml ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// An entrypoint used to run portions of fasta and measure its performance. 5 /// An entrypoint used to run portions of fasta and measure its performance.
6 library front_end.tool.fasta_perf; 6 library front_end.tool.fasta_perf;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 var listener = new DirectiveListenerWithNative(); 162 var listener = new DirectiveListenerWithNative();
163 new TopLevelParser(listener).parseUnit(tokenize(contents)); 163 new TopLevelParser(listener).parseUnit(tokenize(contents));
164 return new Set<String>() 164 return new Set<String>()
165 ..addAll(listener.imports.map((directive) => directive.uri)) 165 ..addAll(listener.imports.map((directive) => directive.uri))
166 ..addAll(listener.exports.map((directive) => directive.uri)) 166 ..addAll(listener.exports.map((directive) => directive.uri))
167 ..addAll(listener.parts); 167 ..addAll(listener.parts);
168 } 168 }
169 169
170 class DirectiveListenerWithNative extends DirectiveListener { 170 class DirectiveListenerWithNative extends DirectiveListener {
171 @override 171 @override
172 Token handleNativeClause(Token token) => skipNativeClause(token, true); 172 Token handleNativeClauseError(Token token) => skipNativeClause(token, true);
173 } 173 }
174 174
175 /// Parses every file in [files] and reports the time spent doing so. 175 /// Parses every file in [files] and reports the time spent doing so.
176 void parseFiles(Map<Uri, List<int>> files) { 176 void parseFiles(Map<Uri, List<int>> files) {
177 scanTimer = new Stopwatch(); 177 scanTimer = new Stopwatch();
178 var parseTimer = new Stopwatch()..start(); 178 var parseTimer = new Stopwatch()..start();
179 files.forEach((uri, source) { 179 files.forEach((uri, source) {
180 parseFull(uri, source); 180 parseFull(uri, source);
181 }); 181 });
182 parseTimer.stop(); 182 parseTimer.stop();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 /// Report that metric [name] took [time] micro-seconds to process 247 /// Report that metric [name] took [time] micro-seconds to process
248 /// [inputSize] characters. 248 /// [inputSize] characters.
249 void report(String name, int time) { 249 void report(String name, int time) {
250 var sb = new StringBuffer(); 250 var sb = new StringBuffer();
251 var padding = ' ' * (20 - name.length); 251 var padding = ' ' * (20 - name.length);
252 sb.write('$name:$padding $time us, ${time ~/ 1000} ms'); 252 sb.write('$name:$padding $time us, ${time ~/ 1000} ms');
253 var invSpeed = (time * 1000 / inputSize).toStringAsFixed(2); 253 var invSpeed = (time * 1000 / inputSize).toStringAsFixed(2);
254 sb.write(', $invSpeed ns/char'); 254 sb.write(', $invSpeed ns/char');
255 print('$sb'); 255 print('$sb');
256 } 256 }
OLDNEW
« no previous file with comments | « pkg/front_end/messages.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698