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 /** | 5 /** |
6 * A function element that represents a closure call. The signature is copied | 6 * A function element that represents a closure call. The signature is copied |
7 * from the given element. | 7 * from the given element. |
8 */ | 8 */ |
9 class ClosureInvocationElement extends FunctionElement { | 9 class ClosureInvocationElement extends FunctionElement { |
10 ClosureInvocationElement(SourceString name, | 10 ClosureInvocationElement(SourceString name, |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
646 String currentIsolate = "${namer.CURRENT_ISOLATE}"; | 646 String currentIsolate = "${namer.CURRENT_ISOLATE}"; |
647 String mainEnsureGetter = ''; | 647 String mainEnsureGetter = ''; |
648 // Since we pass the closurized version of the main method to | 648 // Since we pass the closurized version of the main method to |
649 // the isolate method, we must make sure that it exists. | 649 // the isolate method, we must make sure that it exists. |
650 if (!compiler.universe.staticFunctionsNeedingGetter.contains(appMain)) { | 650 if (!compiler.universe.staticFunctionsNeedingGetter.contains(appMain)) { |
651 String invocationName = | 651 String invocationName = |
652 "${namer.closureInvocationName(Selector.INVOCATION_0)}"; | 652 "${namer.closureInvocationName(Selector.INVOCATION_0)}"; |
653 mainEnsureGetter = "$mainAccess.$invocationName = $mainAccess"; | 653 mainEnsureGetter = "$mainAccess.$invocationName = $mainAccess"; |
654 } | 654 } |
655 | 655 |
656 // TODO(ngeoffray): These globals are currently required by the isolate | 656 if (compiler.isMockCompilation) return ""; |
657 // library, but since leg already generates code on an Isolate object, they | 657 |
658 // are not really needed. We should remove them once Leg replaces Frog. | 658 // TODO(ngeoffray): These globals are currently required by the isolate |
659 // library, but since leg already generates code on an Isolate object, they | |
660 // are not really needed. We should remove them once Leg replaces Frog. | |
659 return """ | 661 return """ |
660 var \$globalThis = $currentIsolate; | 662 var \$globalThis = $currentIsolate; |
661 var \$globalState; | 663 var \$globalState; |
662 var \$globals; | 664 var \$globals; |
663 function \$static_init(){}; | 665 function \$static_init(){}; |
664 | 666 |
665 function \$initGlobals(context) { | 667 function \$initGlobals(context) { |
666 context.isolateStatics = new ${namer.ISOLATE}(); | 668 context.isolateStatics = new ${namer.ISOLATE}(); |
667 } | 669 } |
668 function \$setGlobals(context) { | 670 function \$setGlobals(context) { |
(...skipping 16 matching lines...) Expand all Loading... | |
685 emitCompileTimeConstants(buffer); | 687 emitCompileTimeConstants(buffer); |
686 emitStaticFinalFieldInitializations(buffer); | 688 emitStaticFinalFieldInitializations(buffer); |
687 nativeEmitter.emitDynamicDispatchMetadata(buffer); | 689 nativeEmitter.emitDynamicDispatchMetadata(buffer); |
688 buffer.add('var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n'); | 690 buffer.add('var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n'); |
689 Element main = compiler.mainApp.find(Compiler.MAIN); | 691 Element main = compiler.mainApp.find(Compiler.MAIN); |
690 if (compiler.isolateLibrary != null) { | 692 if (compiler.isolateLibrary != null) { |
691 Element isolateMain = | 693 Element isolateMain = |
692 compiler.isolateLibrary.find(Compiler.START_ROOT_ISOLATE); | 694 compiler.isolateLibrary.find(Compiler.START_ROOT_ISOLATE); |
693 buffer.add(buildIsolateSetup(main, isolateMain)); | 695 buffer.add(buildIsolateSetup(main, isolateMain)); |
694 } else { | 696 } else { |
695 buffer.add('${namer.isolateAccess(main)}();\n'); | 697 if (!compiler.isMockCompilation) { |
ngeoffray
2012/03/22 07:54:03
I would remove this check and the one line 656, to
ahe
2012/03/22 09:59:39
Done.
| |
698 buffer.add('${namer.isolateAccess(main)}();\n'); | |
699 } | |
696 } | 700 } |
697 compiler.assembledCode = buffer.toString(); | 701 compiler.assembledCode = buffer.toString(); |
698 }); | 702 }); |
699 return compiler.assembledCode; | 703 return compiler.assembledCode; |
700 } | 704 } |
701 } | 705 } |
OLD | NEW |