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

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

Issue 947333004: dart2js: simplify constant expression generation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix long line. Created 5 years, 9 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) 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;
11 11
12 MainCallStubGenerator(this.compiler, this.backend, this.emitterTask); 12 MainCallStubGenerator(this.compiler, this.backend, this.emitterTask);
13 13
14 /// Returns the code equivalent to: 14 /// Returns the code equivalent to:
15 /// `function(args) { $.startRootIsolate(X.main$closure(), args); }` 15 /// `function(args) { $.startRootIsolate(X.main$closure(), args); }`
16 jsAst.Expression _buildIsolateSetupClosure(Element appMain, 16 jsAst.Expression _buildIsolateSetupClosure(Element appMain,
17 Element isolateMain) { 17 Element isolateMain) {
18 jsAst.Expression mainAccess = 18 jsAst.Expression mainAccess =
19 emitterTask.isolateStaticClosureAccess(appMain); 19 emitterTask.isolateStaticClosureAccess(appMain);
20 // Since we pass the closurized version of the main method to 20 // Since we pass the closurized version of the main method to
21 // the isolate method, we must make sure that it exists. 21 // the isolate method, we must make sure that it exists.
22 return js('function(a){ #(#, a); }', 22 return js('function(a){ #(#, a); }',
23 [emitterTask.staticFunctionAccess(isolateMain), mainAccess]); 23 [emitterTask.staticFunctionAccess(isolateMain), mainAccess]);
24 } 24 }
25 25
26 26
27 jsAst.Statement generateInvokeMain() { 27 jsAst.Statement generateInvokeMain() {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 if (typeof dartMainRunner === "function") { 73 if (typeof dartMainRunner === "function") {
74 dartMainRunner(#mainCallClosure, []); 74 dartMainRunner(#mainCallClosure, []);
75 } else { 75 } else {
76 #mainCallClosure([]); 76 #mainCallClosure([]);
77 } 77 }
78 })''', 78 })''',
79 {'currentScript': currentScriptAccess, 79 {'currentScript': currentScriptAccess,
80 'mainCallClosure': mainCallClosure}); 80 'mainCallClosure': mainCallClosure});
81 } 81 }
82 } 82 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/code_emitter_task.dart ('k') | 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