| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 // Tests that the closed world computed from [WorldImpact]s derived from kernel | 5 // Tests that the closed world computed from [WorldImpact]s derived from kernel |
| 6 // is equivalent to the original computed from resolution. | 6 // is equivalent to the original computed from resolution. |
| 7 library dart2js.kernel.closed_world_test; | 7 library dart2js.kernel.closed_world_test; |
| 8 | 8 |
| 9 import 'package:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; |
| 10 import 'package:compiler/src/commandline_options.dart'; | 10 import 'package:compiler/src/commandline_options.dart'; |
| 11 import 'package:compiler/src/common.dart'; | 11 import 'package:compiler/src/common.dart'; |
| 12 import 'package:compiler/src/common_elements.dart'; | 12 import 'package:compiler/src/common_elements.dart'; |
| 13 import 'package:compiler/src/common/backend_api.dart'; |
| 13 import 'package:compiler/src/common/resolution.dart'; | 14 import 'package:compiler/src/common/resolution.dart'; |
| 14 import 'package:compiler/src/compiler.dart'; | 15 import 'package:compiler/src/compiler.dart'; |
| 15 import 'package:compiler/src/elements/resolution_types.dart'; | 16 import 'package:compiler/src/elements/resolution_types.dart'; |
| 16 import 'package:compiler/src/elements/elements.dart'; | 17 import 'package:compiler/src/elements/elements.dart'; |
| 17 import 'package:compiler/src/enqueue.dart'; | 18 import 'package:compiler/src/enqueue.dart'; |
| 18 import 'package:compiler/src/js_backend/backend.dart'; | 19 import 'package:compiler/src/js_backend/backend.dart'; |
| 19 import 'package:compiler/src/js_backend/backend_helpers.dart'; | 20 import 'package:compiler/src/js_backend/backend_helpers.dart'; |
| 20 import 'package:compiler/src/js_backend/backend_impact.dart'; | 21 import 'package:compiler/src/js_backend/backend_impact.dart'; |
| 21 import 'package:compiler/src/js_backend/backend_usage.dart'; | 22 import 'package:compiler/src/js_backend/backend_usage.dart'; |
| 22 import 'package:compiler/src/js_backend/custom_elements_analysis.dart'; | 23 import 'package:compiler/src/js_backend/custom_elements_analysis.dart'; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 new BackendHelpers(elementEnvironment, commonElements); | 169 new BackendHelpers(elementEnvironment, commonElements); |
| 169 BackendImpacts impacts = new BackendImpacts(options, commonElements, helpers); | 170 BackendImpacts impacts = new BackendImpacts(options, commonElements, helpers); |
| 170 | 171 |
| 171 // TODO(johnniwinther): Create Kernel based implementations for these: | 172 // TODO(johnniwinther): Create Kernel based implementations for these: |
| 172 NativeBasicData nativeBasicData; | 173 NativeBasicData nativeBasicData; |
| 173 RuntimeTypesNeedBuilder rtiNeedBuilder; | 174 RuntimeTypesNeedBuilder rtiNeedBuilder; |
| 174 MirrorsDataBuilder mirrorsDataBuilder; | 175 MirrorsDataBuilder mirrorsDataBuilder; |
| 175 CustomElementsResolutionAnalysis customElementsResolutionAnalysis; | 176 CustomElementsResolutionAnalysis customElementsResolutionAnalysis; |
| 176 LookupMapResolutionAnalysis lookupMapResolutionAnalysis; | 177 LookupMapResolutionAnalysis lookupMapResolutionAnalysis; |
| 177 MirrorsResolutionAnalysis mirrorsResolutionAnalysis; | 178 MirrorsResolutionAnalysis mirrorsResolutionAnalysis; |
| 178 NativeResolutionEnqueuer nativeResolutionEnqueuer; | |
| 179 | 179 |
| 180 BackendClasses backendClasses = new JavaScriptBackendClasses( |
| 181 elementEnvironment, helpers, nativeBasicData); |
| 180 InterceptorDataBuilder interceptorDataBuilder = | 182 InterceptorDataBuilder interceptorDataBuilder = |
| 181 new InterceptorDataBuilderImpl( | 183 new InterceptorDataBuilderImpl( |
| 182 nativeBasicData, helpers, elementEnvironment, commonElements); | 184 nativeBasicData, helpers, elementEnvironment, commonElements); |
| 183 BackendUsageBuilder backendUsageBuilder = | 185 BackendUsageBuilder backendUsageBuilder = |
| 184 new BackendUsageBuilderImpl(commonElements, helpers); | 186 new BackendUsageBuilderImpl(commonElements, helpers); |
| 185 NoSuchMethodRegistry noSuchMethodRegistry = new NoSuchMethodRegistry( | 187 NoSuchMethodRegistry noSuchMethodRegistry = new NoSuchMethodRegistry( |
| 186 helpers, new KernelNoSuchMethodResolver(worldBuilder)); | 188 helpers, new KernelNoSuchMethodResolver(worldBuilder)); |
| 189 NativeResolutionEnqueuer nativeResolutionEnqueuer = |
| 190 new NativeResolutionEnqueuer( |
| 191 options, |
| 192 elementEnvironment, |
| 193 commonElements, |
| 194 helpers, |
| 195 backendClasses, |
| 196 backendUsageBuilder, |
| 197 new KernelNativeClassResolver(worldBuilder)); |
| 187 | 198 |
| 188 return new ResolutionEnqueuerListener( | 199 return new ResolutionEnqueuerListener( |
| 189 options, | 200 options, |
| 190 elementEnvironment, | 201 elementEnvironment, |
| 191 commonElements, | 202 commonElements, |
| 192 helpers, | 203 helpers, |
| 193 impacts, | 204 impacts, |
| 194 new JavaScriptBackendClasses( | 205 backendClasses, |
| 195 elementEnvironment, helpers, nativeBasicData), | |
| 196 nativeBasicData, | 206 nativeBasicData, |
| 197 interceptorDataBuilder, | 207 interceptorDataBuilder, |
| 198 backendUsageBuilder, | 208 backendUsageBuilder, |
| 199 rtiNeedBuilder, | 209 rtiNeedBuilder, |
| 200 mirrorsDataBuilder, | 210 mirrorsDataBuilder, |
| 201 noSuchMethodRegistry, | 211 noSuchMethodRegistry, |
| 202 customElementsResolutionAnalysis, | 212 customElementsResolutionAnalysis, |
| 203 lookupMapResolutionAnalysis, | 213 lookupMapResolutionAnalysis, |
| 204 mirrorsResolutionAnalysis, | 214 mirrorsResolutionAnalysis, |
| 205 new TypeVariableResolutionAnalysis( | 215 new TypeVariableResolutionAnalysis( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 217 compiler.libraryLoader.libraries); | 227 compiler.libraryLoader.libraries); |
| 218 enqueuer.forEach((work) { | 228 enqueuer.forEach((work) { |
| 219 MemberElement element = work.element; | 229 MemberElement element = work.element; |
| 220 ResolutionImpact resolutionImpact = build(compiler, element.resolvedAst); | 230 ResolutionImpact resolutionImpact = build(compiler, element.resolvedAst); |
| 221 WorldImpact worldImpact = compiler.backend.impactTransformer | 231 WorldImpact worldImpact = compiler.backend.impactTransformer |
| 222 .transformResolutionImpact(enqueuer, resolutionImpact); | 232 .transformResolutionImpact(enqueuer, resolutionImpact); |
| 223 enqueuer.applyImpact(worldImpact, impactSource: element); | 233 enqueuer.applyImpact(worldImpact, impactSource: element); |
| 224 }); | 234 }); |
| 225 return enqueuer.worldBuilder.closeWorld(compiler.reporter); | 235 return enqueuer.worldBuilder.closeWorld(compiler.reporter); |
| 226 } | 236 } |
| OLD | NEW |