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 library dart2js.js_emitter.program_builder; | 5 library dart2js.js_emitter.program_builder; |
6 | 6 |
7 import '../../closure.dart' show ClosureFieldElement; | 7 import '../../closure.dart' show ClosureFieldElement; |
8 import '../../common.dart'; | 8 import '../../common.dart'; |
9 import '../../common/names.dart' show Names, Selectors; | 9 import '../../common/names.dart' show Names, Selectors; |
10 import '../../compiler.dart' show Compiler; | 10 import '../../compiler.dart' show Compiler; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 List<js.TokenFinalizer> finalizers = [_task.metadataCollector]; | 177 List<js.TokenFinalizer> finalizers = [_task.metadataCollector]; |
178 if (backend.namer is js.TokenFinalizer) { | 178 if (backend.namer is js.TokenFinalizer) { |
179 var namingFinalizer = backend.namer; | 179 var namingFinalizer = backend.namer; |
180 finalizers.add(namingFinalizer); | 180 finalizers.add(namingFinalizer); |
181 } | 181 } |
182 | 182 |
183 return new Program(fragments, holders, _buildLoadMap(), _symbolsMap, | 183 return new Program(fragments, holders, _buildLoadMap(), _symbolsMap, |
184 _buildTypeToInterceptorMap(), _task.metadataCollector, finalizers, | 184 _buildTypeToInterceptorMap(), _task.metadataCollector, finalizers, |
185 needsNativeSupport: needsNativeSupport, | 185 needsNativeSupport: needsNativeSupport, |
186 outputContainsConstantList: collector.outputContainsConstantList, | 186 outputContainsConstantList: collector.outputContainsConstantList, |
187 hasIsolateSupport: _compiler.hasIsolateSupport); | 187 hasIsolateSupport: backend.hasIsolateSupport); |
188 } | 188 } |
189 | 189 |
190 void _markEagerClasses() { | 190 void _markEagerClasses() { |
191 _markEagerInterceptorClasses(); | 191 _markEagerInterceptorClasses(); |
192 } | 192 } |
193 | 193 |
194 /// Builds a map from loadId to outputs-to-load. | 194 /// Builds a map from loadId to outputs-to-load. |
195 Map<String, List<Fragment>> _buildLoadMap() { | 195 Map<String, List<Fragment>> _buildLoadMap() { |
196 Map<String, List<Fragment>> loadMap = <String, List<Fragment>>{}; | 196 Map<String, List<Fragment>> loadMap = <String, List<Fragment>>{}; |
197 _compiler.deferredLoadTask.hunksToLoad | 197 _compiler.deferredLoadTask.hunksToLoad |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 } | 668 } |
669 | 669 |
670 bool _methodCanBeReflected(FunctionElement method) { | 670 bool _methodCanBeReflected(FunctionElement method) { |
671 return backend.isAccessibleByReflection(method) || | 671 return backend.isAccessibleByReflection(method) || |
672 // During incremental compilation, we have to assume that reflection | 672 // During incremental compilation, we have to assume that reflection |
673 // *might* get enabled. | 673 // *might* get enabled. |
674 _compiler.options.hasIncrementalSupport; | 674 _compiler.options.hasIncrementalSupport; |
675 } | 675 } |
676 | 676 |
677 bool _methodCanBeApplied(FunctionElement method) { | 677 bool _methodCanBeApplied(FunctionElement method) { |
678 return _compiler.hasFunctionApplySupport && | 678 return backend.hasFunctionApplySupport && |
679 _compiler.closedWorld.getMightBePassedToApply(method); | 679 _compiler.closedWorld.getMightBePassedToApply(method); |
680 } | 680 } |
681 | 681 |
682 // TODO(herhut): Refactor incremental compilation and remove method. | 682 // TODO(herhut): Refactor incremental compilation and remove method. |
683 Method buildMethodHackForIncrementalCompilation(FunctionElement element) { | 683 Method buildMethodHackForIncrementalCompilation(FunctionElement element) { |
684 assert(_compiler.options.hasIncrementalSupport); | 684 assert(_compiler.options.hasIncrementalSupport); |
685 if (element.isInstanceMember) { | 685 if (element.isInstanceMember) { |
686 return _buildMethod(element); | 686 return _buildMethod(element); |
687 } else { | 687 } else { |
688 return _buildStaticMethod(element); | 688 return _buildStaticMethod(element); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 Constant constant = new Constant(name, holder, constantValue); | 981 Constant constant = new Constant(name, holder, constantValue); |
982 _constants[constantValue] = constant; | 982 _constants[constantValue] = constant; |
983 } | 983 } |
984 } | 984 } |
985 | 985 |
986 Holder _registerStaticStateHolder() { | 986 Holder _registerStaticStateHolder() { |
987 return _registry.registerHolder(namer.staticStateHolder, | 987 return _registry.registerHolder(namer.staticStateHolder, |
988 isStaticStateHolder: true); | 988 isStaticStateHolder: true); |
989 } | 989 } |
990 } | 990 } |
OLD | NEW |