Chromium Code Reviews| OLD | NEW |
|---|---|
| 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; | 5 part of dart2js; |
| 6 | 6 |
| 7 class EnqueueTask extends CompilerTask { | 7 class EnqueueTask extends CompilerTask { |
| 8 final ResolutionEnqueuer resolution; | 8 final ResolutionEnqueuer resolution; |
| 9 final CodegenEnqueuer codegen; | 9 final CodegenEnqueuer codegen; |
| 10 | 10 |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 407 elements = getCachedElements(element); | 407 elements = getCachedElements(element); |
| 408 } | 408 } |
| 409 compiler.world.registerUsedElement(element); | 409 compiler.world.registerUsedElement(element); |
| 410 | 410 |
| 411 if (elements == null) { | 411 if (elements == null) { |
| 412 queue.add( | 412 queue.add( |
| 413 new ResolutionWorkItem(element, itemCompilationContextCreator())); | 413 new ResolutionWorkItem(element, itemCompilationContextCreator())); |
| 414 } | 414 } |
| 415 | 415 |
| 416 // Enable isolate support if we start using something from the | 416 // Enable isolate support if we start using something from the |
| 417 // isolate library. | 417 // isolate library. |
|
kasperl
2013/01/11 11:58:08
or if we use timers from the dart:async library.
ngeoffray
2013/01/11 12:20:19
Done.
| |
| 418 LibraryElement library = element.getLibrary(); | 418 LibraryElement library = element.getLibrary(); |
| 419 if (!compiler.hasIsolateSupport() | 419 if (!compiler.hasIsolateSupport()) { |
| 420 && library.uri.toString() == 'dart:isolate') { | 420 String uri = library.uri.toString(); |
| 421 enableIsolateSupport(library); | 421 if (uri == 'dart:isolate') { |
| 422 enableIsolateSupport(library); | |
| 423 } else if (uri == 'dart:async') { | |
| 424 ClassElement cls = element.getEnclosingClass(); | |
| 425 if (cls != null && cls.name == const SourceString('Timer')) { | |
| 426 // The [:Timer:] class uses the event queue of the isolate | |
| 427 // library, so we make sure that event queue is generated. | |
| 428 enableIsolateSupport(library); | |
| 429 } | |
| 430 } | |
| 422 } | 431 } |
| 423 | 432 |
| 424 return true; | 433 return true; |
| 425 } | 434 } |
| 426 | 435 |
| 427 void enableIsolateSupport(LibraryElement element) { | 436 void enableIsolateSupport(LibraryElement element) { |
| 428 compiler.isolateLibrary = element.patch; | 437 compiler.isolateLibrary = element.patch; |
| 429 addToWorkList( | 438 addToWorkList( |
| 430 compiler.isolateHelperLibrary.find(Compiler.START_ROOT_ISOLATE)); | 439 compiler.isolateHelperLibrary.find(Compiler.START_ROOT_ISOLATE)); |
| 431 addToWorkList(compiler.isolateHelperLibrary.find( | 440 addToWorkList(compiler.isolateHelperLibrary.find( |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 543 while(!queue.isEmpty) { | 552 while(!queue.isEmpty) { |
| 544 // TODO(johnniwinther): Find an optimal process order for codegen. | 553 // TODO(johnniwinther): Find an optimal process order for codegen. |
| 545 f(queue.removeLast()); | 554 f(queue.removeLast()); |
| 546 } | 555 } |
| 547 } | 556 } |
| 548 | 557 |
| 549 void _logSpecificSummary(log(message)) { | 558 void _logSpecificSummary(log(message)) { |
| 550 log('Compiled ${universe.generatedCode.length} methods.'); | 559 log('Compiled ${universe.generatedCode.length} methods.'); |
| 551 } | 560 } |
| 552 } | 561 } |
| OLD | NEW |