| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 class MainCallStubGenerator { | 7 class MainCallStubGenerator { |
| 8 final Compiler compiler; | 8 final Compiler compiler; |
| 9 final JavaScriptBackend backend; | 9 final JavaScriptBackend backend; |
| 10 final CodeEmitterTask emitterTask; | 10 final CodeEmitterTask emitterTask; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 emitterTask.isolateStaticClosureAccess(appMain); | 21 emitterTask.isolateStaticClosureAccess(appMain); |
| 22 // Since we pass the closurized version of the main method to | 22 // Since we pass the closurized version of the main method to |
| 23 // the isolate method, we must make sure that it exists. | 23 // the isolate method, we must make sure that it exists. |
| 24 return js('function(a){ #(#, a); }', | 24 return js('function(a){ #(#, a); }', |
| 25 [emitterTask.staticFunctionAccess(isolateMain), mainAccess]); | 25 [emitterTask.staticFunctionAccess(isolateMain), mainAccess]); |
| 26 } | 26 } |
| 27 | 27 |
| 28 jsAst.Statement generateInvokeMain() { | 28 jsAst.Statement generateInvokeMain() { |
| 29 Element main = compiler.mainFunction; | 29 Element main = compiler.mainFunction; |
| 30 jsAst.Expression mainCallClosure = null; | 30 jsAst.Expression mainCallClosure = null; |
| 31 if (compiler.hasIsolateSupport) { | 31 if (compiler.resolverWorld.hasIsolateSupport) { |
| 32 Element isolateMain = | 32 Element isolateMain = |
| 33 helpers.isolateHelperLibrary.find(BackendHelpers.START_ROOT_ISOLATE); | 33 helpers.isolateHelperLibrary.find(BackendHelpers.START_ROOT_ISOLATE); |
| 34 mainCallClosure = _buildIsolateSetupClosure(main, isolateMain); | 34 mainCallClosure = _buildIsolateSetupClosure(main, isolateMain); |
| 35 } else if (compiler.options.hasIncrementalSupport) { | 35 } else if (compiler.options.hasIncrementalSupport) { |
| 36 mainCallClosure = js( | 36 mainCallClosure = js( |
| 37 'function() { return #(); }', emitterTask.staticFunctionAccess(main)); | 37 'function() { return #(); }', emitterTask.staticFunctionAccess(main)); |
| 38 } else { | 38 } else { |
| 39 mainCallClosure = emitterTask.staticFunctionAccess(main); | 39 mainCallClosure = emitterTask.staticFunctionAccess(main); |
| 40 } | 40 } |
| 41 | 41 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } else { | 78 } else { |
| 79 #mainCallClosure([]); | 79 #mainCallClosure([]); |
| 80 } | 80 } |
| 81 })''', | 81 })''', |
| 82 { | 82 { |
| 83 'currentScript': currentScriptAccess, | 83 'currentScript': currentScriptAccess, |
| 84 'mainCallClosure': mainCallClosure | 84 'mainCallClosure': mainCallClosure |
| 85 }); | 85 }); |
| 86 } | 86 } |
| 87 } | 87 } |
| OLD | NEW |