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

Unified Diff: src/compiler/simplified-operator-reducer.cc

Issue 647773004: [turbofan] Skip bounds checks for positive indices only. (Closed) Base URL: git@github.com:v8/v8.git@master
Patch Set: Created 6 years, 2 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 | test/mjsunit/asm/int32array-constant-key.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-operator-reducer.cc
diff --git a/src/compiler/simplified-operator-reducer.cc b/src/compiler/simplified-operator-reducer.cc
index 49b87b22a1aa036f15ccaee3028d6b90131f910c..21a18eacce27eac0b98492bb387fe20c6f8070ce 100644
--- a/src/compiler/simplified-operator-reducer.cc
+++ b/src/compiler/simplified-operator-reducer.cc
@@ -106,7 +106,7 @@ Reduction SimplifiedOperatorReducer::Reduce(Node* node) {
NumericValueMatcher mlength(node->InputAt(2));
if (mkey.HasValue() && mlength.HasValue()) {
// Skip the typed array bounds check if key and length are constant.
- if (mkey.Value() < mlength.Value()) {
+ if (mkey.Value() >= 0 && mkey.Value() < mlength.Value()) {
access.bounds_check = kNoBoundsCheck;
node->set_op(simplified()->LoadElement(access));
return Changed(node);
@@ -122,7 +122,7 @@ Reduction SimplifiedOperatorReducer::Reduce(Node* node) {
NumericValueMatcher mlength(node->InputAt(2));
if (mkey.HasValue() && mlength.HasValue()) {
// Skip the typed array bounds check if key and length are constant.
- if (mkey.Value() < mlength.Value()) {
+ if (mkey.Value() >= 0 && mkey.Value() < mlength.Value()) {
access.bounds_check = kNoBoundsCheck;
node->set_op(simplified()->StoreElement(access));
return Changed(node);
« no previous file with comments | « no previous file | test/mjsunit/asm/int32array-constant-key.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698