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

Side by Side Diff: frog/world.dart

Issue 9270048: Lots of frog cleanup (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 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 | Annotate | Revision Log
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 /** The one true [World]. */ 5 /** The one true [World]. */
6 World world; 6 World world;
7 7
8 /** 8 /**
9 * Experimental phase to enable await, only set when using the 9 * Experimental phase to enable await, only set when using the
10 * await/awaitc.dart entrypoint. 10 * await/awaitc.dart entrypoint.
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 } 399 }
400 return res; 400 return res;
401 } 401 }
402 402
403 void runCompilationPhases() { 403 void runCompilationPhases() {
404 final lib = withTiming('first pass', () => processDartScript()); 404 final lib = withTiming('first pass', () => processDartScript());
405 withTiming('resolve top level', resolveAll); 405 withTiming('resolve top level', resolveAll);
406 if (experimentalAwaitPhase != null) { 406 if (experimentalAwaitPhase != null) {
407 withTiming('await translation', experimentalAwaitPhase); 407 withTiming('await translation', experimentalAwaitPhase);
408 } 408 }
409 withTiming('analyze pass', () { analyzeCode(lib); });
409 withTiming('generate code', () { generateCode(lib); }); 410 withTiming('generate code', () { generateCode(lib); });
410 } 411 }
411 412
412 String getGeneratedCode() { 413 String getGeneratedCode() {
413 // TODO(jimhug): Assert compilation is all done here. 414 // TODO(jimhug): Assert compilation is all done here.
414 if (legCode != null) { 415 if (legCode != null) {
415 assert(options.enableLeg); 416 assert(options.enableLeg);
416 return legCode; 417 return legCode;
417 } else { 418 } else {
418 return frogCode; 419 return frogCode;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 } 478 }
478 479
479 findMainMethod(Library lib) { 480 findMainMethod(Library lib) {
480 var main = lib.lookup('main', lib.span); 481 var main = lib.lookup('main', lib.span);
481 if (main == null) { 482 if (main == null) {
482 fatal('no main method specified'); 483 fatal('no main method specified');
483 } 484 }
484 return main; 485 return main;
485 } 486 }
486 487
488 /**
489 * Walks all code in lib and imports for analysis.
490 */
491 analyzeCode(Library lib) {
492 gen = new WorldGenerator(findMainMethod(lib), new CodeWriter());
493 gen.analyze();
494 }
495
496 /**
497 * Walks all live code to generate JS source for output.
498 */
487 generateCode(Library lib) { 499 generateCode(Library lib) {
488 gen = new WorldGenerator(findMainMethod(lib), new CodeWriter());
489 gen.run(); 500 gen.run();
490 frogCode = gen.writer.text; 501 frogCode = gen.writer.text;
491 jsBytesWritten = frogCode.length; 502 jsBytesWritten = frogCode.length;
492 gen = null; 503 gen = null;
493 } 504 }
494 505
495 // ********************** Message support *********************** 506 // ********************** Message support ***********************
496 507
497 void _message(String color, String prefix, String message, 508 void _message(String color, String prefix, String message,
498 SourceSpan span, SourceSpan span1, SourceSpan span2, bool throwing) { 509 SourceSpan span, SourceSpan span1, SourceSpan span2, bool throwing) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 617
607 withTiming(String name, f()) { 618 withTiming(String name, f()) {
608 final sw = new Stopwatch(); 619 final sw = new Stopwatch();
609 sw.start(); 620 sw.start();
610 var result = f(); 621 var result = f();
611 sw.stop(); 622 sw.stop();
612 info('$name in ${sw.elapsedInMs()}msec'); 623 info('$name in ${sw.elapsedInMs()}msec');
613 return result; 624 return result;
614 } 625 }
615 } 626 }
OLDNEW
« frog/gen.dart ('K') | « frog/var_member.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698