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

Unified Diff: pkg/compiler/lib/src/cps_ir/update_refinements.dart

Issue 2246623002: Delete CPS IR (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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
Index: pkg/compiler/lib/src/cps_ir/update_refinements.dart
diff --git a/pkg/compiler/lib/src/cps_ir/update_refinements.dart b/pkg/compiler/lib/src/cps_ir/update_refinements.dart
deleted file mode 100644
index 20d333f55c2f2e0695495a288473872f2f648416..0000000000000000000000000000000000000000
--- a/pkg/compiler/lib/src/cps_ir/update_refinements.dart
+++ /dev/null
@@ -1,100 +0,0 @@
-library dart2js.cps_ir.update_refinements;
-
-import '../world.dart';
-import 'cps_ir_nodes.dart';
-import 'optimizers.dart' show Pass;
-import 'type_mask_system.dart';
-
-/// Updates all references to use the most refined version in scope.
-///
-/// [GVN] and [RedundantJoinElimination], and possibly other passes, can create
-/// references that don't use the best refinement in scope. This pass improves
-/// the refinement information.
-///
-//
-// TODO(asgerf): Could be done during GVN for another adjacent pass.
-// It is easier to measure performance and rearrange passes when it has its
-// own pass, but we can merge it with an adjacent pass later.
-//
-class UpdateRefinements extends TrampolineRecursiveVisitor implements Pass {
- String get passName => 'Update refinements';
-
- final TypeMaskSystem typeSystem;
- World get classWorld => typeSystem.classWorld;
-
- Map<Primitive, Primitive> refinementFor = <Primitive, Primitive>{};
-
- UpdateRefinements(this.typeSystem);
-
- void rewrite(FunctionDefinition node) {
- visit(node);
- }
-
- Expression traverseLetPrim(LetPrim node) {
- Expression next = node.body;
- visit(node.primitive);
- return next;
- }
-
- visitReceiverCheck(ReceiverCheck node) {
- if (refine(node.valueRef)) {
- // Update the type if the input has changed.
- Primitive value = node.value;
- if (value.type.needsNoSuchMethodHandling(node.selector, classWorld)) {
- node.type = typeSystem.receiverTypeFor(node.selector, value.type);
- } else {
- // Check is no longer needed.
- node
- ..replaceUsesWith(value)
- ..destroy();
- LetPrim letPrim = node.parent;
- letPrim.remove();
- return;
- }
- }
- // Use the ReceiverCheck as a refinement.
- Primitive value = node.effectiveDefinition;
- Primitive old = refinementFor[value];
- refinementFor[value] = node;
- pushAction(() {
- refinementFor[value] = old;
- });
- }
-
- visitRefinement(Refinement node) {
- if (refine(node.value)) {
- // Update the type if the input has changed.
- node.type =
- typeSystem.intersection(node.value.definition.type, node.refineType);
- }
- Primitive value = node.effectiveDefinition;
- Primitive old = refinementFor[value];
- refinementFor[value] = node;
- pushAction(() {
- refinementFor[value] = old;
- });
- }
-
- visitBoundsCheck(BoundsCheck node) {
- super.visitBoundsCheck(node);
- if (node.hasIntegerCheck && typeSystem.isDefinitelyInt(node.index.type)) {
- node.checks &= ~BoundsCheck.INTEGER;
- }
- }
-
- processReference(Reference ref) {
- refine(ref);
- }
-
- bool refine(Reference ref) {
- Definition def = ref.definition;
- if (def is Primitive) {
- Primitive refinement = refinementFor[def.effectiveDefinition];
- if (refinement != null && refinement != ref.definition) {
- ref.changeTo(refinement);
- return true;
- }
- }
- return false;
- }
-}
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/type_propagation.dart ('k') | pkg/compiler/lib/src/cps_ir/use_field_initializers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698