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

Unified Diff: pkg/compiler/lib/src/cps_ir/type_propagation.dart

Issue 1479193002: dart2js cps: Add more constraint rules to bounds-check elimination. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merge Created 5 years 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/cps_ir/octagon.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/cps_ir/type_propagation.dart
diff --git a/pkg/compiler/lib/src/cps_ir/type_propagation.dart b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
index 906ed6f531333462d5c04577672944bcb82a697b..c89173ad0cf60ca506e49032c8a664a98529417c 100644
--- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart
+++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
@@ -1233,10 +1233,12 @@ class TransformingVisitor extends DeepRecursiveVisitor {
return cps;
}
Continuation fail = cps.letCont();
- Primitive isTooSmall = cps.applyBuiltin(
- BuiltinOperator.NumLt,
- <Primitive>[index, cps.makeZero()]);
- cps.ifTruthy(isTooSmall).invokeContinuation(fail);
+ if (!typeSystem.isDefinitelyNonNegativeInt(index.type)) {
+ Primitive isTooSmall = cps.applyBuiltin(
+ BuiltinOperator.NumLt,
+ <Primitive>[index, cps.makeZero()]);
+ cps.ifTruthy(isTooSmall).invokeContinuation(fail);
+ }
Primitive isTooLarge = cps.applyBuiltin(
BuiltinOperator.NumGe,
<Primitive>[index, cps.letPrim(new GetLength(list))]);
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/octagon.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698