| 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'; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 compiler.resolutionWorldBuilder.closeWorld(compiler.reporter); | 83 compiler.resolutionWorldBuilder.closeWorld(compiler.reporter); |
| 84 | 84 |
| 85 JavaScriptBackend backend = compiler.backend; | 85 JavaScriptBackend backend = compiler.backend; |
| 86 // Create a new resolution enqueuer and feed it with the [WorldImpact]s | 86 // Create a new resolution enqueuer and feed it with the [WorldImpact]s |
| 87 // computed from kernel through the [build] in `kernel_impact.dart`. | 87 // computed from kernel through the [build] in `kernel_impact.dart`. |
| 88 ResolutionEnqueuer enqueuer = new ResolutionEnqueuer( | 88 ResolutionEnqueuer enqueuer = new ResolutionEnqueuer( |
| 89 compiler.enqueuer, | 89 compiler.enqueuer, |
| 90 compiler.options, | 90 compiler.options, |
| 91 compiler.reporter, | 91 compiler.reporter, |
| 92 const TreeShakingEnqueuerStrategy(), | 92 const TreeShakingEnqueuerStrategy(), |
| 93 compiler.globalDependencies, | |
| 94 backend, | 93 backend, |
| 95 backend.nativeResolutionEnqueuer(), | 94 backend.nativeResolutionEnqueuer(), |
| 96 new ResolutionWorldBuilderImpl( | 95 new ResolutionWorldBuilderImpl( |
| 97 compiler.backend, compiler.resolution, const OpenWorldStrategy()), | 96 compiler.backend, compiler.resolution, const OpenWorldStrategy()), |
| 98 new ResolutionWorkItemBuilder(compiler.resolution), | 97 new ResolutionWorkItemBuilder(compiler.resolution), |
| 99 'enqueuer from kernel'); | 98 'enqueuer from kernel'); |
| 100 ClosedWorld closedWorld = computeClosedWorld(compiler, enqueuer); | 99 ClosedWorld closedWorld = computeClosedWorld(compiler, enqueuer); |
| 101 | 100 |
| 102 checkResolutionEnqueuers(compiler.backend, compiler.backend, | 101 checkResolutionEnqueuers(compiler.backend, compiler.backend, |
| 103 compiler.enqueuer.resolution, enqueuer, | 102 compiler.enqueuer.resolution, enqueuer, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 backend.computeMainImpact(compiler.mainFunction, forResolution: true)); | 142 backend.computeMainImpact(compiler.mainFunction, forResolution: true)); |
| 144 enqueuer.forEach((work) { | 143 enqueuer.forEach((work) { |
| 145 AstElement element = work.element; | 144 AstElement element = work.element; |
| 146 ResolutionImpact resolutionImpact = build(compiler, element.resolvedAst); | 145 ResolutionImpact resolutionImpact = build(compiler, element.resolvedAst); |
| 147 WorldImpact worldImpact = compiler.backend.impactTransformer | 146 WorldImpact worldImpact = compiler.backend.impactTransformer |
| 148 .transformResolutionImpact(enqueuer, resolutionImpact); | 147 .transformResolutionImpact(enqueuer, resolutionImpact); |
| 149 enqueuer.applyImpact(worldImpact, impactSource: element); | 148 enqueuer.applyImpact(worldImpact, impactSource: element); |
| 150 }); | 149 }); |
| 151 return enqueuer.worldBuilder.closeWorld(compiler.reporter); | 150 return enqueuer.worldBuilder.closeWorld(compiler.reporter); |
| 152 } | 151 } |
| OLD | NEW |