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

Unified Diff: lib/compiler/implementation/ssa/optimize.dart

Issue 10139012: Refactor types in ssa nodes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: More fixes. Created 8 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
Index: lib/compiler/implementation/ssa/optimize.dart
diff --git a/lib/compiler/implementation/ssa/optimize.dart b/lib/compiler/implementation/ssa/optimize.dart
index 0fc69479a1ca25836511dff7ac436814acab4964..2ed56c8a219bf40a4a4fedb162c40550cd525f3a 100644
--- a/lib/compiler/implementation/ssa/optimize.dart
+++ b/lib/compiler/implementation/ssa/optimize.dart
@@ -341,7 +341,9 @@ class SsaConstantFolder extends HBaseVisitor implements OptimizationPhase {
HInstruction visitTypeGuard(HTypeGuard node) {
HInstruction value = node.guarded;
- HType combinedType = value.propagatedType.combine(node.guardedType);
+ // If the union of the types is still the guarded type than the incoming
+ // type was a subtype of the guarded type, and no check is required.
+ HType combinedType = value.propagatedType.union(node.guardedType);
return (combinedType == value.propagatedType) ? value : node;
}
@@ -450,7 +452,7 @@ class SsaCheckInserter extends HBaseVisitor implements OptimizationPhase {
}
void visitIndex(HIndex node) {
- if (!node.receiver.isStringOrArray()) return;
+ if (!node.receiver.isIndexablePrimitive()) return;
HInstruction index = node.index;
if (index is HBoundsCheck) return;
if (!node.index.isInteger()) {

Powered by Google App Engine
This is Rietveld 408576698