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

Side by Side Diff: pkg/compiler/lib/src/js_model/js_strategy.dart

Issue 2951723002: Add closure_test for kernel based members (Closed)
Patch Set: Cleanup Created 3 years, 6 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
« no previous file with comments | « pkg/compiler/lib/src/dart2js.dart ('k') | pkg/compiler/lib/src/kernel/closure.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 '../backend_strategy.dart';
8 import '../closure.dart' show ClosureConversionTask; 7 import '../closure.dart' show ClosureConversionTask;
9 import '../common/tasks.dart'; 8 import '../common/tasks.dart';
10 import '../common_elements.dart'; 9 import '../common_elements.dart';
11 import '../compiler.dart'; 10 import '../compiler.dart';
12 import '../elements/elements.dart' show TypedefElement; 11 import '../elements/elements.dart' show TypedefElement;
13 import '../elements/entities.dart'; 12 import '../elements/entities.dart';
14 import '../enqueue.dart'; 13 import '../enqueue.dart';
15 import '../io/source_information.dart'; 14 import '../io/source_information.dart';
16 import '../js_emitter/sorter.dart'; 15 import '../js_emitter/sorter.dart';
17 import '../js/js_source_mapping.dart'; 16 import '../js/js_source_mapping.dart';
18 import '../js_backend/backend.dart'; 17 import '../js_backend/backend.dart';
19 import '../js_backend/backend_usage.dart'; 18 import '../js_backend/backend_usage.dart';
20 import '../js_backend/constant_system_javascript.dart'; 19 import '../js_backend/constant_system_javascript.dart';
21 import '../js_backend/interceptor_data.dart'; 20 import '../js_backend/interceptor_data.dart';
22 import '../js_backend/native_data.dart'; 21 import '../js_backend/native_data.dart';
23 import '../kernel/closure.dart'; 22 import '../kernel/closure.dart';
24 import '../kernel/element_map.dart'; 23 import '../kernel/element_map.dart';
25 import '../kernel/element_map_impl.dart'; 24 import '../kernel/element_map_impl.dart';
26 import '../kernel/kernel_backend_strategy.dart'; 25 import '../kernel/kernel_backend_strategy.dart';
27 import '../kernel/kernel_strategy.dart'; 26 import '../kernel/kernel_strategy.dart';
28 import '../ssa/ssa.dart'; 27 import '../ssa/ssa.dart';
29 import '../universe/class_set.dart'; 28 import '../universe/class_set.dart';
30 import '../universe/world_builder.dart'; 29 import '../universe/world_builder.dart';
31 import '../util/emptyset.dart'; 30 import '../util/emptyset.dart';
32 import '../world.dart'; 31 import '../world.dart';
33 import 'elements.dart'; 32 import 'elements.dart';
34 33
35 class JsBackendStrategy implements BackendStrategy { 34 class JsBackendStrategy implements KernelBackendStrategy {
36 final Compiler _compiler; 35 final Compiler _compiler;
37 final JsToFrontendMap _map = new JsToFrontendMapImpl(); 36 final JsToFrontendMap _map = new JsToFrontendMapImpl();
38 ElementEnvironment _elementEnvironment; 37 ElementEnvironment _elementEnvironment;
39 CommonElements _commonElements; 38 CommonElements _commonElements;
40 KernelToElementMap __elementMap; 39 KernelToElementMap _elementMap;
41 ClosureConversionTask _closureDataLookup; 40 ClosureConversionTask _closureDataLookup;
42 GlobalLocalsMap _globalLocalsMap = new GlobalLocalsMap(); 41 final GlobalLocalsMap _globalLocalsMap = new GlobalLocalsMap();
43 42
44 JsBackendStrategy(this._compiler); 43 JsBackendStrategy(this._compiler);
45 44
46 KernelToElementMap get _elementMap { 45 KernelToElementMap get elementMap {
47 if (__elementMap == null) { 46 if (_elementMap == null) {
48 KernelFrontEndStrategy strategy = _compiler.frontendStrategy; 47 KernelFrontEndStrategy strategy = _compiler.frontendStrategy;
49 KernelToElementMap elementMap = strategy.elementMap; 48 KernelToElementMap elementMap = strategy.elementMap;
50 __elementMap = new JsKernelToElementMap( 49 _elementMap = new JsKernelToElementMap(
51 _map, _elementEnvironment, _commonElements, elementMap); 50 _map, _elementEnvironment, _commonElements, elementMap);
52 } 51 }
53 return __elementMap; 52 return _elementMap;
54 } 53 }
55 54
55 GlobalLocalsMap get globalLocalsMapForTesting => _globalLocalsMap;
56
56 @override 57 @override
57 ClosedWorldRefiner createClosedWorldRefiner(ClosedWorld closedWorld) { 58 ClosedWorldRefiner createClosedWorldRefiner(ClosedWorld closedWorld) {
58 _elementEnvironment = 59 _elementEnvironment =
59 new JsElementEnvironment(_map, closedWorld.elementEnvironment); 60 new JsElementEnvironment(_map, closedWorld.elementEnvironment);
60 _commonElements = new JsCommonElements(_map, closedWorld.commonElements); 61 _commonElements = new JsCommonElements(_map, closedWorld.commonElements);
61 BackendUsage backendUsage = 62 BackendUsage backendUsage =
62 new JsBackendUsage(_map, closedWorld.backendUsage); 63 new JsBackendUsage(_map, closedWorld.backendUsage);
63 NativeData nativeData = new JsNativeData(_map, closedWorld.nativeData); 64 NativeData nativeData = new JsNativeData(_map, closedWorld.nativeData);
64 InterceptorData interceptorData = new InterceptorDataImpl( 65 InterceptorData interceptorData = new InterceptorDataImpl(
65 nativeData, 66 nativeData,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 126 }
126 127
127 @override 128 @override
128 Sorter get sorter { 129 Sorter get sorter {
129 throw new UnimplementedError('JsBackendStrategy.sorter'); 130 throw new UnimplementedError('JsBackendStrategy.sorter');
130 } 131 }
131 132
132 @override 133 @override
133 ClosureConversionTask get closureDataLookup => 134 ClosureConversionTask get closureDataLookup =>
134 _closureDataLookup ??= new KernelClosureConversionTask( 135 _closureDataLookup ??= new KernelClosureConversionTask(
135 _compiler.measurer, _elementMap, _globalLocalsMap); 136 _compiler.measurer, elementMap, _globalLocalsMap);
136 137
137 @override 138 @override
138 SourceInformationStrategy get sourceInformationStrategy => 139 SourceInformationStrategy get sourceInformationStrategy =>
139 const JavaScriptSourceInformationStrategy(); 140 const JavaScriptSourceInformationStrategy();
140 141
141 @override 142 @override
142 SsaBuilder createSsaBuilder(CompilerTask task, JavaScriptBackend backend, 143 SsaBuilder createSsaBuilder(CompilerTask task, JavaScriptBackend backend,
143 SourceInformationStrategy sourceInformationStrategy) { 144 SourceInformationStrategy sourceInformationStrategy) {
144 return new KernelSsaBuilder( 145 return new KernelSsaBuilder(
145 task, backend.compiler, _elementMap, _globalLocalsMap); 146 task, backend.compiler, elementMap, _globalLocalsMap);
146 } 147 }
147 148
148 @override 149 @override
149 WorkItemBuilder createCodegenWorkItemBuilder(ClosedWorld closedWorld) { 150 WorkItemBuilder createCodegenWorkItemBuilder(ClosedWorld closedWorld) {
150 return new KernelCodegenWorkItemBuilder(_compiler.backend, closedWorld); 151 return new KernelCodegenWorkItemBuilder(_compiler.backend, closedWorld);
151 } 152 }
152 153
153 @override 154 @override
154 CodegenWorldBuilder createCodegenWorldBuilder( 155 CodegenWorldBuilder createCodegenWorldBuilder(
155 NativeBasicData nativeBasicData, 156 NativeBasicData nativeBasicData,
156 ClosedWorld closedWorld, 157 ClosedWorld closedWorld,
157 SelectorConstraintsStrategy selectorConstraintsStrategy) { 158 SelectorConstraintsStrategy selectorConstraintsStrategy) {
158 return new KernelCodegenWorldBuilder( 159 return new KernelCodegenWorldBuilder(
159 _elementMap, 160 elementMap,
160 closedWorld.elementEnvironment, 161 closedWorld.elementEnvironment,
161 nativeBasicData, 162 nativeBasicData,
162 closedWorld, 163 closedWorld,
163 selectorConstraintsStrategy); 164 selectorConstraintsStrategy);
164 } 165 }
165 } 166 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/dart2js.dart ('k') | pkg/compiler/lib/src/kernel/closure.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698