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

Unified Diff: src/compiler/simplified-lowering.cc

Issue 2229343002: [turbofan] Improve typing for CheckBounds. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix redundancy check. Created 4 years, 4 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 | src/compiler/typer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-lowering.cc
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc
index d72fc827591350c7b4283b89ee861cb23bb340d8..6e560dbffcc68634665cc073444ff94a2ab3bd2c 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -2104,7 +2104,8 @@ class RepresentationSelector {
}
case IrOpcode::kCheckBounds: {
- if (TypeOf(node->InputAt(0))->Is(Type::Unsigned32())) {
+ Type* index_type = TypeOf(node->InputAt(0));
+ if (index_type->Is(Type::Unsigned32())) {
VisitBinop(node, UseInfo::TruncatingWord32(),
MachineRepresentation::kWord32);
} else {
@@ -2112,6 +2113,13 @@ class RepresentationSelector {
UseInfo::TruncatingWord32(),
MachineRepresentation::kWord32);
}
+ if (lower()) {
+ // The bounds check is redundant if we already know that
+ // the index is within the bounds of [0.0, length[.
+ if (index_type->Is(NodeProperties::GetType(node))) {
+ DeferReplacement(node, node->InputAt(0));
+ }
+ }
return;
}
case IrOpcode::kCheckIf: {
« no previous file with comments | « no previous file | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698