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

Side by Side Diff: lib/compiler/samples/leap/leap_leg.dart

Issue 11265024: Make methods in Stopwatch getters and rename to be more consistent. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status files with co19 issue number. Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « lib/compiler/implementation/tools/mini_parser.dart ('k') | lib/core/stopwatch.dart » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 compilerIsolate(port) { 5 compilerIsolate(port) {
6 Runner runner = new Runner(); 6 Runner runner = new Runner();
7 runner.init(); 7 runner.init();
8 8
9 port.receive((msg, replyTo) { 9 port.receive((msg, replyTo) {
10 replyTo.send(runner.update(msg)); 10 replyTo.send(runner.update(msg));
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 class Runner { 121 class Runner {
122 final LeapCompiler compiler; 122 final LeapCompiler compiler;
123 123
124 Runner() : compiler = new LeapCompiler(); 124 Runner() : compiler = new LeapCompiler();
125 125
126 String init() { 126 String init() {
127 Stopwatch sw = new Stopwatch()..start(); 127 Stopwatch sw = new Stopwatch()..start();
128 compiler.scanBuiltinLibraries(); 128 compiler.scanBuiltinLibraries();
129 sw.stop(); 129 sw.stop();
130 return 'Scanned core libraries in ${sw.elapsedInMs()}ms'; 130 return 'Scanned core libraries in ${sw.elapsedMilliseconds}ms';
131 } 131 }
132 132
133 String update(String codeText) { 133 String update(String codeText) {
134 StringBuffer sb = new StringBuffer(); 134 StringBuffer sb = new StringBuffer();
135 135
136 Stopwatch sw = new Stopwatch()..start(); 136 Stopwatch sw = new Stopwatch()..start();
137 137
138 LibraryElement e = compile(new LeapScript(codeText)); 138 LibraryElement e = compile(new LeapScript(codeText));
139 139
140 void printFunction(FunctionElement fe, [String indentation = ""]) { 140 void printFunction(FunctionElement fe, [String indentation = ""]) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 case ElementKind.CLASS: 190 case ElementKind.CLASS:
191 printClass(c); 191 printClass(c);
192 break; 192 break;
193 193
194 case ElementKind.FIELD: 194 case ElementKind.FIELD:
195 printField (c); 195 printField (c);
196 break; 196 break;
197 } 197 }
198 } 198 }
199 199
200 compiler.log("Outline ${sw.elapsedInMs()}"); 200 compiler.log("Outline ${sw.elapsedMilliseconds}");
201 return sb.toString(); 201 return sb.toString();
202 } 202 }
203 203
204 Element compile(String script) { 204 Element compile(String script) {
205 return compiler.runSelective(script); 205 return compiler.runSelective(script);
206 } 206 }
207 } 207 }
208 208
209 class LeapCompiler extends Compiler { 209 class LeapCompiler extends Compiler {
210 HttpRequestCache cache; 210 HttpRequestCache cache;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 Element runSelective(Script script) { 263 Element runSelective(Script script) {
264 Stopwatch sw = new Stopwatch()..start(); 264 Stopwatch sw = new Stopwatch()..start();
265 Element e; 265 Element e;
266 try { 266 try {
267 e = runCompilerSelective(script); 267 e = runCompilerSelective(script);
268 } on CompilerCancelledException catch (exception) { 268 } on CompilerCancelledException catch (exception) {
269 log(exception.toString()); 269 log(exception.toString());
270 log('compilation failed'); 270 log('compilation failed');
271 return null; 271 return null;
272 } 272 }
273 log('compilation succeeded: ${sw.elapsedInMs()}ms'); 273 log('compilation succeeded: ${sw.elapsedMilliseconds}ms');
274 return e; 274 return e;
275 } 275 }
276 276
277 LibraryElement runCompilerSelective(Script script) { 277 LibraryElement runCompilerSelective(Script script) {
278 mainApp = new LibraryElement(script); 278 mainApp = new LibraryElement(script);
279 279
280 universe.libraries.remove(script.uri.toString()); 280 universe.libraries.remove(script.uri.toString());
281 Element element; 281 Element element;
282 withCurrentElement(mainApp, () { 282 withCurrentElement(mainApp, () {
283 scanner.scan(mainApp); 283 scanner.scan(mainApp);
284 }); 284 });
285 return mainApp; 285 return mainApp;
286 } 286 }
287 } 287 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/tools/mini_parser.dart ('k') | lib/core/stopwatch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698