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

Unified Diff: pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart

Issue 2939163002: Modify backend strategy and how we access the closure converter. (Closed)
Patch Set: . 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/js_model/js_strategy.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart
diff --git a/pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart b/pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart
index fd15e52a7b6e4e8b3dc920f9bc7ebecdc689eb25..b085a564e707c5a535eb95538a420efe91147ebb 100644
--- a/pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart
+++ b/pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart
@@ -60,10 +60,8 @@ class KernelBackendStrategy implements BackendStrategy {
}
@override
- void convertClosures(ClosedWorldRefiner closedWorldRefiner) {
- // TODO(johnniwinther,efortuna): Compute closure classes for kernel based
- // elements.
- }
+ ClosureConversionTask createClosureConversionTask(Compiler compiler) =>
+ new KernelClosureConversionTask(compiler.measurer);
@override
WorkItemBuilder createCodegenWorkItemBuilder(ClosedWorld closedWorld) {
@@ -151,8 +149,8 @@ class KernelSsaBuilderTask extends CompilerTask implements SsaBuilderTask {
closedWorld,
_compiler.codegenWorldBuilder,
work.registry,
+ _compiler.closureDataLookup,
// TODO(johnniwinther): Support these:
- const KernelClosureDataLookup(),
const SourceInformationBuilder(),
null, // Function node used as capture scope id.
targetIsConstructorBody: false);
@@ -309,9 +307,32 @@ class KLocal implements Local {
}
}
-/// TODO(johnniwinther,efortuna): Implement this.
-class KernelClosureDataLookup implements ClosureDataLookup<ir.Node> {
- const KernelClosureDataLookup();
+/// Closure conversion code using our new Entity model. Closure conversion is
+/// necessary because the semantics of closures are slightly different in Dart
+/// than JavaScript. Closure conversion is separated out into two phases:
+/// generation of a new (temporary) representation to store where variables need
+/// to be hoisted/captured up at another level to re-write the closure, and then
+/// the code generation phase where we generate elements and/or instructions to
+/// represent this new code path.
+///
+/// For a general explanation of how closure conversion works at a high level,
+/// check out:
+/// http://siek.blogspot.com/2012/07/essence-of-closure-conversion.html or
+/// http://matt.might.net/articles/closure-conversion/.
+class KernelClosureConversionTask extends ClosureConversionTask<ir.Node> {
+ KernelClosureConversionTask(Measurer measurer) : super(measurer);
+
+ /// The combined steps of generating our intermediate representation of
+ /// closures that need to be rewritten and generating the element model.
+ /// Ultimately these two steps will be split apart with the second step
+ /// happening later in compilation just before codegen. These steps are
+ /// combined here currently to provide a consistent interface to the rest of
+ /// the compiler until we are ready to separate these phases.
+ @override
+ void convertClosures(Iterable<MemberEntity> processedEntities,
+ ClosedWorldRefiner closedWorldRefiner) {
+ // TODO(efortuna): implement.
+ }
@override
ClosureAnalysisInfo getClosureAnalysisInfo(ir.Node node) {
« no previous file with comments | « pkg/compiler/lib/src/js_model/js_strategy.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698