OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 library js_backend.backend.codegen_listener; | 5 library js_backend.backend.codegen_listener; |
6 | 6 |
7 import '../common/names.dart' show Identifiers; | 7 import '../common/names.dart' show Identifiers; |
8 import '../common_elements.dart' show CommonElements, ElementEnvironment; | 8 import '../common_elements.dart' show CommonElements, ElementEnvironment; |
9 import '../constants/values.dart'; | 9 import '../constants/values.dart'; |
10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // The JavaScript backend of [Isolate.spawnUri] uses the same internal | 98 // The JavaScript backend of [Isolate.spawnUri] uses the same internal |
99 // implementation as [Isolate.spawn], and fails if it cannot look main up | 99 // implementation as [Isolate.spawn], and fails if it cannot look main up |
100 // by name. | 100 // by name. |
101 impactBuilder.registerStaticUse(new StaticUse.staticTearOff(mainMethod)); | 101 impactBuilder.registerStaticUse(new StaticUse.staticTearOff(mainMethod)); |
102 } | 102 } |
103 _impacts.isolateSupport.registerImpact(impactBuilder, _elementEnvironment); | 103 _impacts.isolateSupport.registerImpact(impactBuilder, _elementEnvironment); |
104 return impactBuilder; | 104 return impactBuilder; |
105 } | 105 } |
106 | 106 |
107 /// Computes the [WorldImpact] of calling [mainMethod] as the entry point. | 107 /// Computes the [WorldImpact] of calling [mainMethod] as the entry point. |
108 WorldImpact _computeMainImpact(MethodElement mainMethod) { | 108 WorldImpact _computeMainImpact(FunctionEntity mainMethod) { |
109 WorldImpactBuilderImpl mainImpact = new WorldImpactBuilderImpl(); | 109 WorldImpactBuilderImpl mainImpact = new WorldImpactBuilderImpl(); |
110 if (mainMethod.parameters.isNotEmpty) { | 110 CallStructure callStructure = mainMethod.parameterStructure.callStructure; |
| 111 if (callStructure.argumentCount > 0) { |
111 _impacts.mainWithArguments | 112 _impacts.mainWithArguments |
112 .registerImpact(mainImpact, _elementEnvironment); | 113 .registerImpact(mainImpact, _elementEnvironment); |
113 mainImpact.registerStaticUse( | 114 mainImpact.registerStaticUse( |
114 new StaticUse.staticInvoke(mainMethod, CallStructure.TWO_ARGS)); | 115 new StaticUse.staticInvoke(mainMethod, callStructure)); |
115 // If the main method takes arguments, this compilation could be the | 116 // If the main method takes arguments, this compilation could be the |
116 // target of Isolate.spawnUri. Strictly speaking, that can happen also if | 117 // target of Isolate.spawnUri. Strictly speaking, that can happen also if |
117 // main takes no arguments, but in this case the spawned isolate can't | 118 // main takes no arguments, but in this case the spawned isolate can't |
118 // communicate with the spawning isolate. | 119 // communicate with the spawning isolate. |
119 mainImpact.addImpact(_enableIsolateSupport(mainMethod)); | 120 mainImpact.addImpact(_enableIsolateSupport(mainMethod)); |
120 } | 121 } |
121 mainImpact.registerStaticUse( | 122 mainImpact.registerStaticUse( |
122 new StaticUse.staticInvoke(mainMethod, CallStructure.NO_ARGS)); | 123 new StaticUse.staticInvoke(mainMethod, CallStructure.NO_ARGS)); |
123 return mainImpact; | 124 return mainImpact; |
124 } | 125 } |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 WorldImpact registerInstantiatedClass(ClassEntity cls) { | 335 WorldImpact registerInstantiatedClass(ClassEntity cls) { |
335 return _processClass(cls); | 336 return _processClass(cls); |
336 } | 337 } |
337 | 338 |
338 @override | 339 @override |
339 void logSummary(void log(String message)) { | 340 void logSummary(void log(String message)) { |
340 _lookupMapAnalysis.logSummary(log); | 341 _lookupMapAnalysis.logSummary(log); |
341 _nativeEnqueuer.logSummary(log); | 342 _nativeEnqueuer.logSummary(log); |
342 } | 343 } |
343 } | 344 } |
OLD | NEW |