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

Unified Diff: src/compiler/typer.cc

Issue 711923003: [WIP] Faster smi tagging. (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/change-lowering.cc ('k') | no next file » | 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..745a43536afeeb6997adb43d468fa559c92cef82 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -739,6 +739,11 @@ Type* Typer::Visitor::JSBitwiseAndTyper(Type* lhs, Type* rhs, Typer* t) {
double rmin = rhs->Min();
double lmax = lhs->Max();
double rmax = rhs->Max();
+ if (std::min(lmax, rmax) < kMaxInt) {
+ Handle<Object> min = f->NewNumber(0);
+ Handle<Object> max = f->NewNumber(std::min(lmax, rmax));
+ return Type::Range(min, max, t->zone());
+ }
// And-ing any two values results in a value no larger than their maximum.
// Even no larger than their minimum if both values are non-negative.
Handle<Object> max = f->NewNumber(
@@ -780,6 +785,7 @@ Type* Typer::Visitor::JSShiftLeftTyper(Type* lhs, Type* rhs, Typer* t) {
Type* Typer::Visitor::JSShiftRightTyper(Type* lhs, Type* rhs, Typer* t) {
lhs = NumberToInt32(ToNumber(lhs, t), t);
+ rhs = NumberToInt32(ToNumber(rhs, t), t);
Factory* f = t->isolate()->factory();
if (lhs->Min() >= 0) {
// Right-shifting a non-negative value cannot make it negative, nor larger.
@@ -793,6 +799,12 @@ Type* Typer::Visitor::JSShiftRightTyper(Type* lhs, Type* rhs, Typer* t) {
Handle<Object> max = f->NewNumber(-1);
return Type::Range(min, max, t->zone());
}
+ if (rhs->Min() > 0) {
+ // Right-shifting by a positve value yields a small integer value.
+ Handle<Object> min = f->NewNumber(kMinInt >> static_cast<int>(rhs->Min()));
+ Handle<Object> max = f->NewNumber(kMaxInt >> static_cast<int>(rhs->Min()));
+ return Type::Range(min, max, t->zone());
+ }
return Type::Signed32();
}
« no previous file with comments | « src/compiler/change-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698