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

Unified Diff: pkg/compiler/lib/src/ssa/optimize.dart

Issue 2815403004: dart2js: Avoid inserting redundant HTypeKnown (Closed)
Patch Set: Created 3 years, 8 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/ssa/nodes.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/ssa/optimize.dart
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index 3b3a061c6f7eb8ad09f0a83da85e646e85455fd2..f3d934f18c4c48c49a45d3368b3507d855e02b5d 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -905,8 +905,6 @@ class SsaInstructionSimplifier extends HBaseVisitor
return inputType.isInMask(checkedType, _closedWorld) ? input : node;
}
- HInstruction removeCheck(HCheck node) => node.checkedInput;
-
FieldEntity findConcreteFieldForDynamicAccess(
HInstruction receiver, Selector selector) {
TypeMask receiverType = receiver.instructionType;
@@ -2201,6 +2199,17 @@ class SsaTypeConversionInserter extends HBaseVisitor
DominatedUses dominatedUses = DominatedUses.of(input, dominator.first);
if (dominatedUses.isEmpty) return;
+ // Check to avoid adding a duplicate HTypeKnown node.
+ if (dominatedUses.isSingleton) {
+ HInstruction user = dominatedUses.single;
+ if (user is HTypeKnown &&
+ user.isPinned &&
+ user.knownType == convertedType &&
+ user.checkedInput == input) {
+ return;
+ }
+ }
+
HTypeKnown newInput = new HTypeKnown.pinned(convertedType, input);
dominator.addBefore(dominator.first, newInput);
dominatedUses.replaceWith(newInput);
« no previous file with comments | « pkg/compiler/lib/src/ssa/nodes.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698