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

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

Issue 1699033003: dart2js cps: Combine integer type check with bounds check. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rebase Created 4 years, 10 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 | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart ('k') | pkg/compiler/lib/src/cps_ir/type_propagation.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/finalize.dart
diff --git a/pkg/compiler/lib/src/cps_ir/finalize.dart b/pkg/compiler/lib/src/cps_ir/finalize.dart
index 7e3b6e15b2658daed66b59f6aa07e64ac74521d4..dad9e51dd3d6f887593b6a8a140b6595c7425163 100644
--- a/pkg/compiler/lib/src/cps_ir/finalize.dart
+++ b/pkg/compiler/lib/src/cps_ir/finalize.dart
@@ -42,9 +42,14 @@ class Finalize extends TrampolineRecursiveVisitor implements Pass {
return cps;
}
Continuation fail = cps.letCont();
- if (node.hasLowerBoundCheck) {
+ Primitive index = node.index.definition;
+ if (node.hasIntegerCheck) {
+ cps.ifTruthy(cps.applyBuiltin(BuiltinOperator.IsNotUnsigned32BitInteger,
+ [index, index]))
+ .invokeContinuation(fail);
+ } else if (node.hasLowerBoundCheck) {
cps.ifTruthy(cps.applyBuiltin(BuiltinOperator.NumLt,
- [node.index.definition, cps.makeZero()]))
+ [index, cps.makeZero()]))
.invokeContinuation(fail);
}
if (node.hasUpperBoundCheck) {
@@ -59,7 +64,7 @@ class Finalize extends TrampolineRecursiveVisitor implements Pass {
cps.letPrim(length);
}
cps.ifTruthy(cps.applyBuiltin(BuiltinOperator.NumGe,
- [node.index.definition, length]))
+ [index, length]))
.invokeContinuation(fail);
}
if (node.hasEmptinessCheck) {
@@ -69,7 +74,7 @@ class Finalize extends TrampolineRecursiveVisitor implements Pass {
}
cps.insideContinuation(fail).invokeStaticThrower(
helpers.throwIndexOutOfRangeException,
- [node.object.definition, node.index.definition]);
+ [node.object.definition, index]);
node..replaceUsesWith(node.object.definition)..destroy();
return cps;
}
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart ('k') | pkg/compiler/lib/src/cps_ir/type_propagation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698