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

Unified Diff: src/compiler/typer.cc

Issue 713013003: [WIP] Modulus on copy.js. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | « src/compiler/simplified-lowering.cc ('k') | test/cctest/compiler/graph-builder-tester.h » ('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 0fa2b95ebd3460350def99acdd14b2341d7b1b00..914174eea8ed2ce04326e0f721c001b8f75e2537 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -467,6 +467,10 @@ Type* Typer::Visitor::NumberToInt32(Type* type, Typer* t) {
// TODO(neis): DCHECK(type->Is(Type::Number()));
if (type->Is(Type::Signed32())) return type;
if (type->Is(t->zeroish)) return t->singleton_zero;
+ Type* intish = Type::Union(Type::Signed32(), t->zeroish, t->zone());
+ if (type->Is(intish)) {
+ return Type::Intersect(Type::Signed32(), type, t->zone());
+ }
return Type::Signed32();
}
@@ -725,6 +729,10 @@ Type* Typer::Visitor::JSBitwiseOrTyper(Type* lhs, Type* rhs, Typer* t) {
Handle<Object> max = f->NewNumber(-1);
return Type::Range(min, max, t->zone());
}
+ if (rmax == 0 && rmin == 0) {
+ Handle<Object> max = f->NewNumber(lmax);
+ return Type::Range(min, max, t->zone());
+ }
Handle<Object> max = f->NewNumber(Type::Signed32()->Max());
return Type::Range(min, max, t->zone());
// TODO(neis): Be precise for singleton inputs, here and elsewhere.
@@ -1033,8 +1041,7 @@ Type* Typer::Visitor::JSModulusTyper(Type* lhs, Type* rhs, Typer* t) {
lhs = Rangify(lhs, t);
rhs = Rangify(rhs, t);
if (lhs->IsRange() && rhs->IsRange()) {
- // TODO(titzer): fix me.
- // return JSModulusRanger(lhs->AsRange(), rhs->AsRange(), t);
+ return JSModulusRanger(lhs->AsRange(), rhs->AsRange(), t);
}
return Type::OrderedNumber();
}
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | test/cctest/compiler/graph-builder-tester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698