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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/code_emitter_task.dart

Issue 822593004: dart2js: Let the emitter generate the program. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: No need to pass the task to the new emitter. Created 5 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/new_emitter/emitter.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 part of dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 const USE_NEW_EMITTER = const bool.fromEnvironment("dart2js.use.new.emitter"); 7 const USE_NEW_EMITTER = const bool.fromEnvironment("dart2js.use.new.emitter");
8 8
9 /** 9 /**
10 * Generates the code for all used classes in the program. Static fields (even 10 * Generates the code for all used classes in the program. Static fields (even
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 computeNeededStaticNonFinalFields(); 408 computeNeededStaticNonFinalFields();
409 computeNeededLibraries(); 409 computeNeededLibraries();
410 } 410 }
411 411
412 int assembleProgram() { 412 int assembleProgram() {
413 return measure(() { 413 return measure(() {
414 emitter.invalidateCaches(); 414 emitter.invalidateCaches();
415 415
416 computeAllNeededEntities(); 416 computeAllNeededEntities();
417 417
418 Program program = 418 ProgramBuilder programBuilder = new ProgramBuilder(compiler, namer, this);
419 new ProgramBuilder(compiler, namer, this).buildProgram(); 419 return emitter.emitProgram(programBuilder);
420 return emitter.emitProgram(program);
421 }); 420 });
422 } 421 }
423 } 422 }
424 423
425 abstract class Emitter { 424 abstract class Emitter {
426 /// Emits [program] and returns the size of the generated output. 425 /// Uses the [programBuilder] to generate a model of the program, emits
427 int emitProgram(Program program); 426 /// the program, and returns the size of the generated output.
427 int emitProgram(ProgramBuilder programBuilder);
428 428
429 /// Returns the JS function that must be invoked to get the value of the 429 /// Returns the JS function that must be invoked to get the value of the
430 /// lazily initialized static. 430 /// lazily initialized static.
431 jsAst.Expression isolateLazyInitializerAccess(FieldElement element); 431 jsAst.Expression isolateLazyInitializerAccess(FieldElement element);
432 432
433 /// Returns the closure expression of a static function. 433 /// Returns the closure expression of a static function.
434 jsAst.Expression isolateStaticClosureAccess(FunctionElement element); 434 jsAst.Expression isolateStaticClosureAccess(FunctionElement element);
435 435
436 /// Returns the JS code for accessing the embedded [global]. 436 /// Returns the JS code for accessing the embedded [global].
437 jsAst.Expression generateEmbeddedGlobalAccess(String global); 437 jsAst.Expression generateEmbeddedGlobalAccess(String global);
(...skipping 26 matching lines...) Expand all
464 jsAst.Expression closureClassConstructorAccess(ClosureClassElement e); 464 jsAst.Expression closureClassConstructorAccess(ClosureClassElement e);
465 465
466 /// Returns the JS expression representing a function that returns 'null' 466 /// Returns the JS expression representing a function that returns 'null'
467 jsAst.Expression generateFunctionThatReturnsNull(); 467 jsAst.Expression generateFunctionThatReturnsNull();
468 468
469 int compareConstants(ConstantValue a, ConstantValue b); 469 int compareConstants(ConstantValue a, ConstantValue b);
470 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); 470 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant);
471 471
472 void invalidateCaches(); 472 void invalidateCaches();
473 } 473 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/new_emitter/emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698