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

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

Issue 94303002: Add another type JSPositiveInt to show a range analysis in the inferrer would be very beneficial :-… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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: sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/optimize.dart (revision 30754)
+++ sdk/lib/_internal/compiler/implementation/ssa/optimize.dart (working copy)
@@ -214,7 +214,7 @@
Element element = backend.jsIndexableLength;
bool isFixed = isFixedLength(actualReceiver.instructionType, compiler);
HFieldGet result = new HFieldGet(
- element, actualReceiver, backend.intType,
+ element, actualReceiver, backend.positiveIntType,
isAssignable: !isFixed);
return result;
} else if (actualReceiver.isConstantMap()) {
@@ -830,12 +830,15 @@
HInstruction indexArgument) {
Compiler compiler = backend.compiler;
HFieldGet length = new HFieldGet(
- backend.jsIndexableLength, array, backend.intType,
+ backend.jsIndexableLength, array, backend.positiveIntType,
isAssignable: !isFixedLength(array.instructionType, compiler));
indexNode.block.addBefore(indexNode, length);
+ TypeMask type = indexArgument.isPositiveInteger(compiler)
+ ? indexArgument.instructionType
+ : backend.positiveIntType;
HBoundsCheck check = new HBoundsCheck(
- indexArgument, length, array, backend.intType);
+ indexArgument, length, array, type);
indexNode.block.addBefore(indexNode, check);
// If the index input to the bounds check was not known to be an integer
// then we replace its uses with the bounds check, which is known to be an

Powered by Google App Engine
This is Rietveld 408576698