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

Unified Diff: pkg/compiler/lib/src/universe/world_impact.dart

Issue 2527973002: Remove direct access to enqueuer through use of WorldImpact (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/ssa/builder.dart ('k') | pkg/compiler/tool/perf.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/universe/world_impact.dart
diff --git a/pkg/compiler/lib/src/universe/world_impact.dart b/pkg/compiler/lib/src/universe/world_impact.dart
index 90120575b3fb147615ecce641fc69da545b4aa5a..2a1afb812b1bcae59b38f912e87d38558a3c2665 100644
--- a/pkg/compiler/lib/src/universe/world_impact.dart
+++ b/pkg/compiler/lib/src/universe/world_impact.dart
@@ -33,6 +33,8 @@ class WorldImpact {
Iterable<TypeUse> get typeUses => const <TypeUse>[];
+ bool get isEmpty => true;
+
void apply(WorldImpactVisitor visitor) {
staticUses.forEach(visitor.visitStaticUse);
dynamicUses.forEach(visitor.visitDynamicUse);
@@ -74,6 +76,18 @@ class WorldImpactBuilderImpl extends WorldImpact implements WorldImpactBuilder {
Set<StaticUse> _staticUses;
Set<TypeUse> _typeUses;
+ @override
+ bool get isEmpty =>
+ _dynamicUses == null && _staticUses == null && _typeUses == null;
+
+ /// Copy uses in [impact] to this impact builder.
+ void addImpact(WorldImpact impact) {
+ if (impact.isEmpty) return;
+ impact.dynamicUses.forEach(registerDynamicUse);
+ impact.staticUses.forEach(registerStaticUse);
+ impact.typeUses.forEach(registerTypeUse);
+ }
+
void registerDynamicUse(DynamicUse dynamicUse) {
assert(dynamicUse != null);
if (_dynamicUses == null) {
@@ -174,6 +188,14 @@ class TransformedWorldImpact implements WorldImpact, WorldImpactBuilder {
TransformedWorldImpact(this.worldImpact);
@override
+ bool get isEmpty {
+ return worldImpact.isEmpty &&
+ _staticUses == null &&
+ _typeUses == null &&
+ _dynamicUses == null;
+ }
+
+ @override
Iterable<DynamicUse> get dynamicUses {
return _dynamicUses != null ? _dynamicUses : worldImpact.dynamicUses;
}
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | pkg/compiler/tool/perf.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698