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 dart2js.js_model.strategy; | 5 library dart2js.js_model.strategy; |
6 | 6 |
7 import '../closure.dart' show ClosureConversionTask; | 7 import '../closure.dart' show ClosureConversionTask; |
8 import '../common/tasks.dart'; | 8 import '../common/tasks.dart'; |
9 import '../common_elements.dart'; | 9 import '../common_elements.dart'; |
10 import '../compiler.dart'; | 10 import '../compiler.dart'; |
(...skipping 22 matching lines...) Expand all Loading... |
33 import 'locals.dart'; | 33 import 'locals.dart'; |
34 | 34 |
35 class JsBackendStrategy implements KernelBackendStrategy { | 35 class JsBackendStrategy implements KernelBackendStrategy { |
36 final Compiler _compiler; | 36 final Compiler _compiler; |
37 final JsToFrontendMap _map = new JsToFrontendMapImpl(); | 37 final JsToFrontendMap _map = new JsToFrontendMapImpl(); |
38 ElementEnvironment _elementEnvironment; | 38 ElementEnvironment _elementEnvironment; |
39 CommonElements _commonElements; | 39 CommonElements _commonElements; |
40 KernelToElementMapForBuilding _elementMap; | 40 KernelToElementMapForBuilding _elementMap; |
41 ClosureConversionTask _closureDataLookup; | 41 ClosureConversionTask _closureDataLookup; |
42 final GlobalLocalsMap _globalLocalsMap = new GlobalLocalsMap(); | 42 final GlobalLocalsMap _globalLocalsMap = new GlobalLocalsMap(); |
| 43 Sorter _sorter; |
43 | 44 |
44 JsBackendStrategy(this._compiler); | 45 JsBackendStrategy(this._compiler); |
45 | 46 |
46 KernelToElementMapForBuilding get elementMap { | 47 KernelToElementMapForBuilding get elementMap { |
47 if (_elementMap == null) { | 48 if (_elementMap == null) { |
48 KernelFrontEndStrategy strategy = _compiler.frontendStrategy; | 49 KernelFrontEndStrategy strategy = _compiler.frontendStrategy; |
49 KernelToElementMapForBuilding elementMap = strategy.elementMap; | 50 KernelToElementMapForImpact elementMap = strategy.elementMap; |
50 _elementMap = new JsKernelToElementMap( | 51 _elementMap = new JsKernelToElementMap( |
51 _compiler.reporter, | 52 _compiler.reporter, |
52 _compiler.environment, | 53 _compiler.environment, |
53 _map, | 54 _map, |
54 _elementEnvironment, | 55 _elementEnvironment, |
55 _commonElements, | 56 _commonElements, |
56 elementMap); | 57 elementMap); |
57 } | 58 } |
58 return _elementMap; | 59 return _elementMap; |
59 } | 60 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 interceptorData: interceptorData, | 127 interceptorData: interceptorData, |
127 classHierarchyNodes: classHierarchyNodes, | 128 classHierarchyNodes: classHierarchyNodes, |
128 classSets: classSets, | 129 classSets: classSets, |
129 implementedClasses: implementedClasses, | 130 implementedClasses: implementedClasses, |
130 // TODO(johnniwinther): Support this. | 131 // TODO(johnniwinther): Support this. |
131 allTypedefs: new ImmutableEmptySet<TypedefElement>()); | 132 allTypedefs: new ImmutableEmptySet<TypedefElement>()); |
132 } | 133 } |
133 | 134 |
134 @override | 135 @override |
135 Sorter get sorter { | 136 Sorter get sorter { |
136 throw new UnimplementedError('JsBackendStrategy.sorter'); | 137 return _sorter ??= new KernelSorter(elementMap); |
137 } | 138 } |
138 | 139 |
139 @override | 140 @override |
140 ClosureConversionTask get closureDataLookup => | 141 ClosureConversionTask get closureDataLookup => |
141 _closureDataLookup ??= new KernelClosureConversionTask( | 142 _closureDataLookup ??= new KernelClosureConversionTask( |
142 _compiler.measurer, elementMap, _globalLocalsMap); | 143 _compiler.measurer, elementMap, _globalLocalsMap); |
143 | 144 |
144 @override | 145 @override |
145 SourceInformationStrategy get sourceInformationStrategy => | 146 SourceInformationStrategy get sourceInformationStrategy => |
146 const JavaScriptSourceInformationStrategy(); | 147 const JavaScriptSourceInformationStrategy(); |
(...skipping 16 matching lines...) Expand all Loading... |
163 ClosedWorld closedWorld, | 164 ClosedWorld closedWorld, |
164 SelectorConstraintsStrategy selectorConstraintsStrategy) { | 165 SelectorConstraintsStrategy selectorConstraintsStrategy) { |
165 return new KernelCodegenWorldBuilder( | 166 return new KernelCodegenWorldBuilder( |
166 elementMap, | 167 elementMap, |
167 closedWorld.elementEnvironment, | 168 closedWorld.elementEnvironment, |
168 nativeBasicData, | 169 nativeBasicData, |
169 closedWorld, | 170 closedWorld, |
170 selectorConstraintsStrategy); | 171 selectorConstraintsStrategy); |
171 } | 172 } |
172 } | 173 } |
OLD | NEW |