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

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

Issue 1604333002: Implement TypeMask.isDisjoint instead of using intersection. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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/ssa/optimize.dart
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index c98ceb170055e5e02bf38e40aafe8b3e5479083f..a8d82ae15972f17dd059ea22ebce60a69f55e2a2 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -593,8 +593,7 @@ class SsaInstructionSimplifier extends HBaseVisitor
// Intersection of int and double return conflicting, so
// we don't optimize on numbers to preserve the runtime semantics.
if (!(left.isNumberOrNull(compiler) && right.isNumberOrNull(compiler))) {
- TypeMask intersection = leftType.intersection(rightType, compiler.world);
- if (intersection.isEmpty && !intersection.isNullable) {
+ if (leftType.isDisjoint(rightType, compiler.world)) {
return makeFalse();
}
}
@@ -737,8 +736,7 @@ class SsaInstructionSimplifier extends HBaseVisitor
: new TypeMask.nonNullSubtype(element, classWorld);
if (expressionMask.union(typeMask, classWorld) == typeMask) {
return graph.addConstantBool(true, compiler);
- } else if (expressionMask.intersection(typeMask,
- compiler.world).isEmpty) {
+ } else if (expressionMask.isDisjoint(typeMask, compiler.world)) {
return graph.addConstantBool(false, compiler);
}
}
@@ -2154,10 +2152,8 @@ class MemorySet {
if (nonEscapingReceivers.contains(second)) return false;
// Typed arrays of different types might have a shared buffer.
if (couldBeTypedArray(first) && couldBeTypedArray(second)) return true;
- TypeMask intersection = first.instructionType.intersection(
+ return !first.instructionType.isDisjoint(
second.instructionType, compiler.world);
- if (intersection.isEmpty) return false;
- return true;
}
bool isFinal(Element element) {
« no previous file with comments | « pkg/compiler/lib/src/ssa/interceptor_simplifier.dart ('k') | pkg/compiler/lib/src/types/flat_type_mask.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698