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

Unified Diff: src/compiler/typer.cc

Issue 2812013006: [turbofan] Fix typing rule for CheckBounds. (Closed)
Patch Set: Created 3 years, 8 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/regress/regress-crbug-708050-1.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/typer.cc
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc
index ca5f7b47b4d32865cff77cac6c9db6cb84c15454..c44d191652e076639122dfe80b0551dc01e86c6f 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -1810,6 +1810,9 @@ Type* Typer::Visitor::TypeStringIndexOf(Node* node) {
Type* Typer::Visitor::TypeCheckBounds(Node* node) {
Type* index = Operand(node, 0);
Type* length = Operand(node, 1);
+ if (index->Maybe(Type::MinusZero())) {
+ index = Type::Union(index, typer_->cache_.kSingletonZero, zone());
+ }
index = Type::Intersect(index, Type::Integral32(), zone());
if (!index->IsInhabited() || !length->IsInhabited()) return Type::None();
double min = std::max(index->Min(), 0.0);
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-708050-1.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698