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

Unified Diff: pkg/compiler/lib/src/js_backend/type_variable_handler.dart

Issue 2531303002: Decouple WorkItem from Compiler (Closed)
Patch Set: Updated cf. comments. Created 4 years, 1 month 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_backend/lookup_map_analysis.dart ('k') | pkg/compiler/lib/src/kernel/kernel.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/type_variable_handler.dart
diff --git a/pkg/compiler/lib/src/js_backend/type_variable_handler.dart b/pkg/compiler/lib/src/js_backend/type_variable_handler.dart
index ff8822db01b97b127b5a733cf5be76a48d5a5b60..a32a3b59059b4e4efe94fc013a3cc060785b408a 100644
--- a/pkg/compiler/lib/src/js_backend/type_variable_handler.dart
+++ b/pkg/compiler/lib/src/js_backend/type_variable_handler.dart
@@ -44,9 +44,13 @@ class TypeVariableHandler {
Map<TypeVariableElement, jsAst.Expression> _typeVariableConstants =
new Map<TypeVariableElement, jsAst.Expression>();
+ /// Impact builder used for the resolution world computation.
+ final StagedWorldImpactBuilder impactBuilderForResolution =
+ new StagedWorldImpactBuilder();
+
/// Impact builder used for the codegen world computation.
- // TODO(johnniwinther): Add impact builder for resolution.
- final StagedWorldImpactBuilder impactBuilder = new StagedWorldImpactBuilder();
+ final StagedWorldImpactBuilder impactBuilderForCodegen =
+ new StagedWorldImpactBuilder();
TypeVariableHandler(this._compiler);
@@ -59,16 +63,18 @@ class TypeVariableHandler {
/// Compute the [WorldImpact] for the type variables registered since last
/// flush.
WorldImpact flush({bool forResolution}) {
- if (forResolution) return const WorldImpact();
- return impactBuilder.flush();
+ if (forResolution) {
+ return impactBuilderForResolution.flush();
+ } else {
+ return impactBuilderForCodegen.flush();
+ }
}
- void registerClassWithTypeVariables(ClassElement cls, Enqueuer enqueuer) {
- if (enqueuer.isResolutionQueue) {
+ void registerClassWithTypeVariables(ClassElement cls, {bool forResolution}) {
+ if (forResolution) {
// On first encounter, we have to ensure that the support classes get
// resolved.
if (!_seenClassesWithTypeVariables) {
- _backend.enqueueClass(enqueuer, _typeVariableClass);
_typeVariableClass.ensureResolved(_compiler.resolution);
Link constructors = _typeVariableClass.constructors;
if (constructors.isEmpty && constructors.tail.isEmpty) {
@@ -76,11 +82,12 @@ class TypeVariableHandler {
"Class '$_typeVariableClass' should only have one constructor");
}
_typeVariableConstructor = _typeVariableClass.constructors.head;
- _backend.enqueue(enqueuer, _typeVariableConstructor);
- enqueuer.registerInstantiatedType(_typeVariableClass.rawType);
- enqueuer.registerStaticUse(new StaticUse.staticInvoke(
- _backend.registerBackendUse(_backend.helpers.createRuntimeType),
- CallStructure.ONE_ARG));
+ _backend.impactTransformer.registerBackendStaticUse(
+ impactBuilderForResolution, _typeVariableConstructor);
+ _backend.impactTransformer.registerBackendInstantiation(
+ impactBuilderForResolution, _typeVariableClass);
+ _backend.impactTransformer.registerBackendStaticUse(
+ impactBuilderForResolution, _backend.helpers.createRuntimeType);
_seenClassesWithTypeVariables = true;
}
} else {
@@ -117,7 +124,8 @@ class TypeVariableHandler {
_backend.constants.evaluate(constant);
ConstantValue value = _backend.constants.getConstantValue(constant);
- _backend.computeImpactForCompileTimeConstant(value, impactBuilder, false);
+ _backend.computeImpactForCompileTimeConstant(
+ value, impactBuilderForCodegen, false);
_backend.addCompileTimeConstantForEmission(value);
constants
.add(_reifyTypeVariableConstant(value, currentTypeVariable.element));
« no previous file with comments | « pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart ('k') | pkg/compiler/lib/src/kernel/kernel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698