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

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

Issue 1148093005: Fix a bug when narrowing the result type of a field get. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | 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 1529104454cef20120ba4ec7e4c021b412f22844..953a6f48f96a5881dff9bd33dfd6c001729d8e91 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -264,8 +264,17 @@ class SsaInstructionSimplifier extends HBaseVisitor
}
Element element = backend.jsIndexableLength;
bool isFixed = isFixedLength(actualReceiver.instructionType, compiler);
+ TypeMask actualType = node.instructionType;
+ ClassWorld classWorld = compiler.world;
+ TypeMask resultType = backend.positiveIntType;
+ // If we already have computed a more specific type, keep that type.
+ if (actualType.satisfies(backend.jsUInt31Class, classWorld)) {
+ resultType = backend.uint31Type;
+ } else if (actualType.satisfies(backend.jsUInt32Class, classWorld)) {
+ resultType = backend.uint32Type;
+ }
HFieldGet result = new HFieldGet(
- element, actualReceiver, backend.positiveIntType,
+ element, actualReceiver, resultType,
isAssignable: !isFixed);
return result;
} else if (actualReceiver.isConstantMap()) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698